home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / asm_reference / mc68020.doc < prev    next >
Text File  |  1995-09-01  |  99KB  |  3,665 lines

  1.  
  2.  
  3.  
  4.               MOTOROLA MC68020 INSTRUCTION SET
  5.               ================================
  6.  
  7.  
  8. This file contains ALL of the extra instructions and addressing modes found
  9. on the Motorola MC68020 processor, as found in Amiga 2000 machines with acc-
  10. elerator cards fitted, and which can be executed (with very few exceptions)
  11. on Amiga 3000 machines fitted with the Motorola MC68030 processor.
  12.  
  13.  
  14.     The file shall be divided into several sections. First, I shall cover
  15. the additional addressing modes available to MC68020 assembly language prog-
  16. rammers, and the syntaxes used for those new modes. Then, I shall cover fully
  17. the instruction extension words applicable to the MC68020, which follow the
  18. main instruction opcodes and provide the MC68020 with the instruction infor-
  19. mation available to access the new addressing modes. And finally, the comp-
  20. lete set of MC68020 extra instructions PLUS OPCODES follow, documented accor-
  21. ding to the standards laid down in the Official Motorola Documentation.
  22.  
  23.  
  24.                MC68020 - NEW ADDRESSING MODES
  25.                ==============================
  26.  
  27.  
  28. The principal new modes available to the MC68020 fall into two classes:memory
  29. indirect addressing, and bit field addressing. First, I shall outline some of
  30. the conventions used throughout this file. They are:
  31.  
  32.  
  33.         <EA>    : Effective Address. Stands for the
  34.               address of the operand under con-
  35.               sideration, whether computed at
  36.               assembly-time or runtime.
  37.  
  38.         { }    : Curly braces are used to denote a
  39.               bit field. Bit fields are covered
  40.               below.
  41.  
  42.         off    : Offset for bit fields.
  43.  
  44.         wd    : Width for bit fields.
  45.  
  46.         [ ]    : Denotes "contents of".
  47.  
  48.         bd    : Stands for Base Displacement in
  49.               memory indirect addressing.
  50.  
  51.         od    : Stands for Outer Displacement in
  52.               memory indirect addressing.
  53.  
  54.         An    : One of the address registers A0-A7.
  55.  
  56.         Xn    : Any 680x0 data or address register
  57.               used in the context of an index
  58.               register.
  59.  
  60.         scale    : The multiplier applied to the value
  61.               of the index register in memory in-
  62.               direct addresing.
  63.  
  64.         size    : The size attribute applied to the
  65.               index register in memory indirect
  66.               addressing.
  67.  
  68.  
  69. And now, for the various memory indirect addressing modes.
  70.  
  71.  
  72. 1) Memory Indirect Preindexed (using Address Register).
  73.  
  74. Generation    : <EA> = [bd + [An] + [Xn.s]*size] + od
  75.  
  76. Assembler    : ([bd,An,Xn.s*size],od)
  77.  
  78. Mode        : 110 in instruction address mode field
  79.  
  80. Description    : This addressing mode uses two constant displacements,
  81.           an address register, and an index register, PLUS a
  82.           scale factor (five components in all).
  83.  
  84.           First, the contents of the specified Address Register
  85.           are added to the value of the Base Displacement. Then,
  86.           the contents of the specified Index Register are mul-
  87.           tiplied by the specified scale factor (1,2,4 or 8),
  88.           and this value is added to the whole.
  89.  
  90.           This value is then used as a pointer into memory, and
  91.           a longword pointer extracted from memory. The value of
  92.           the Outer Displacement is then added to the value of
  93.           this longword pointer, and this value becomes the
  94.           effective address for the specified operand.
  95.  
  96.           The legal ranges for the various components are:
  97.  
  98.           An        : Any 680x0 address register, A0-A7.
  99.  
  100.           bd        : Base displacement. Can be null, or
  101.                   can be word or longword sized. Word
  102.                   sized displacements are sign-extended
  103.                   to longword values prior to addition.
  104.  
  105.           Xn        : Index register. Can be either a
  106.                   680x0 data register or an address
  107.                   register.
  108.  
  109.           s        : Either .W for word operands, or
  110.                   .L for longword operands. NOTE:
  111.                   word values are sign-extended to
  112.                   longword values prior to addition
  113.                   in common with all 680x0 address
  114.                   arithmetic.
  115.  
  116.           size        : The legal values for the scale
  117.                   factor are 1,2,4 or 8.
  118.  
  119.           od        : Outer displacement. Can be null,
  120.                   or can be word or longword sized.
  121.                   Again, word-sized displacements
  122.                   are sign-extended to longword dis-
  123.                   placements prior to addition.
  124.  
  125. Example        : Let bd = $40000, od = $8000, A0 contain the value
  126.           $20000, D2 contain the value $100, and the longword
  127.           value stored at location $60400 be $30000.
  128.  
  129.           Then, the effective address of:
  130.  
  131.           ([$40000,A0,D2.W*4],$8000.w)
  132.  
  133.           is:
  134.  
  135.           1) $40000 + $20000 + ($100 * 4)
  136.  
  137.              = $60400
  138.  
  139.           2) Contents of $60400 = $30000
  140.  
  141.           3) $30000 + $8000.w = $0003000 + $FFFF8000
  142.  
  143.              = $28000
  144.  
  145.           Therefore the effective address is $28000.
  146.  
  147.  
  148. 2) Memory Indirect Postindexed (using Address Register).
  149.  
  150. Generation    : <EA> = [bd + [An]] + [Xn.s]*size + od
  151.  
  152. Assembler    : ([bd,An],Xn.s*size,od)
  153.  
  154. Mode        : 110 in instruction address mode field
  155.  
  156. Description    : This addressing mode uses the same five components as
  157.           Memory Indirect Preindexed, but in a different order.
  158.  
  159.           First, the contents of the specified address register
  160.           are added to the value of the Base Displacement. This
  161.           value is used as a pointer into memory, from which a
  162.           longword value is extracted. This value has added to
  163.           it the value of the contents of the specified index
  164.           register (multiplied by the given scale factor) and
  165.           the value of the Outer Displacement, to create the
  166.           final effective address.
  167.  
  168.           The range of legal values for the various components
  169.           id identical to that for Memory Indirect Preindexed.
  170.  
  171. Example        : Let bd = $1000, od = $20000, A2 contain the value
  172.           $10000, D7 contain the value $40000, and the long-
  173.           word value stored at $11000 be $58000.
  174.  
  175.           Then, the effective address of:
  176.  
  177.           ([$10000,A2],D7.L*1,$20000)
  178.  
  179.           is:
  180.  
  181.           1) $1000 + $10000 = $11000
  182.  
  183.           2) Contents of $11000 = $58000
  184.  
  185.           3) $58000 + $40000 + $20000 = $B8000
  186.  
  187.           Therefore the effective address is $B8000.
  188.  
  189.  
  190. 3) Program Counter Memory Indirect With Preindex.
  191.  
  192. Generation    : <EA> = [bd + [PC] + [Xn.s]*size] + od
  193.  
  194. Assembler    : ([bd,PC,Xn.s*size],od)
  195.  
  196. Mode        : 111 in instruction address mode field
  197.  
  198. Description    : Add to the value of Base Displacement the value of the
  199.           Program Counter, and the value contained in the speci-
  200.           fied Index Register (multiplied by the specified scale
  201.           factor). Use this total value as a pointer into memory
  202.           and extract a longword value from this memory location.
  203.           Add to this longword value the value of the Outer Dis-
  204.           placement. This final result is the effective address
  205.           of the operand.
  206.  
  207. Example        : Let bd = $4000, PC = $2C00, D5 = $FFFF, and od = $1000.
  208.  
  209.           Let location $6BFE contain the longword $5A800.
  210.  
  211.           Then, the effective address of:
  212.  
  213.           ([$4000,PC,D5.W*2],$1000)
  214.  
  215.           is:
  216.  
  217.           1) $4000 + $2C00 + ($FFFFFFFF * 2)
  218.  
  219.              = $6BFE
  220.  
  221.           2) Contents of $6BFE = $5A800.
  222.  
  223.           3) $5A800 + $1000 = $5B800.
  224.  
  225.           Therefore the effective address is $5B800.
  226.  
  227.  
  228. 4) Program Counter Memory Indirect With Postindex.
  229.  
  230. Generation    : <EA> = [bd + [PC]] + [Xn.s]*size + od
  231.  
  232. Assembler    : ([bd,PC],Xn.s*size,od)
  233.  
  234. Mode        : 111 in instruction address mode field
  235.  
  236. Description    : Add to the value of Base Displacement the value of the
  237.           Program Counter, and use this as a pointer into memory.
  238.           Extract the longword value stored at this address, and
  239.           add to this extracted value the value of the specified
  240.           Index Register (multiplied by the specified scale fac-
  241.           tor), and the value of the Outer Displacement. This fi-
  242.           nal value is the effective address of the operand.
  243.  
  244. Example        : Let bd = $6000, PC = $1A00, D1 = $0020, and od = $7000.
  245.  
  246.           Let location $7A00 contain the longword $FC0000.
  247.  
  248.           Then, the effective address of:
  249.  
  250.           ([$6000,PC],D1.L*4,$7000)
  251.  
  252.           is:
  253.  
  254.           1) $6000 + $1A00 = $7A00
  255.  
  256.           2) Contents of $7A00 = $FC0000.
  257.  
  258.           3) $FC0000 + ($0020 * 4) + $7000 = $FC7080.
  259.  
  260.           Therefore the effective address is $FC7080.
  261.  
  262.  
  263. Note that with ANY of the memory indirect modes, the programmer can omit any
  264. desired component for the desired effect. For example:
  265.  
  266.                                     +
  267.     68020 Instruction            68000 Equivalent
  268.  
  269.     MOVE.L    ([Base]),D0            MOVE.L Base,A0
  270.                         MOVE.L (A0),D0
  271.  
  272.     MOVE.L    ([Base,A0]),D0            MOVE.L    Base(A0),A0
  273.                         MOVE.L    (A0),D0
  274.  
  275.     JMP    ([0,A0],D0.W*4)            ADD.W    D0,D0
  276.                         ADD.W    D0,D0
  277.                         MOVE.L    0(A0,D0.W),A0
  278.                         JMP    (A0)
  279.  
  280.     MOVE.W    ([Base,A0],D2.L*8,Outer),D7    MOVE.L    Base(A0),A0
  281.                         ADD.L    D2,D2
  282.                         ADD.L    D2,D2
  283.                         ADD.L    D2,D2
  284.                         LEA    Outer(A0),A0
  285.                         MOVE.L    0(A0,D2.L),D7
  286.  
  287.  
  288. Note that the 68020 forms can complete the given operation in one instruction
  289. whereas the 68000 needs two or more instructions to perform the same task, &
  290. requires extra register use. Hence the use of the '+' character to highlight
  291. the fact that the equivalence is NOT complete - in general the 68020 does NOT
  292. change the contents of the registers in the source operand UNLESS the destin-
  293. ation happens to be one of those registers also. Note also how the 68020 can
  294. access a jump table in one instruction - see the 68000 equivalent alongside!
  295.  
  296.  
  297.     It can be seen from this that the 68020 addressing extensions are so
  298. far ahead of the already powerful 68000 addressing modes (which still kick an
  299. Intel chip into a cocked hat!) that Motorola didn't need to add any more to
  300. the 68030 and 68040 (after all, many programmers still can't cope with single
  301. instructions that are equivalent to half a C program...).
  302.  
  303.  
  304.     It remains to cover bit fields. Bit fields are so radically different
  305. from normal addressing modes that they do take a little getting used to. The
  306. basic idea is that any collection of bits, of any size (within certain rest-
  307. rictions), aligned anywhere in memory (not even on a byte boundary!) can be
  308. accessed and manipulated.
  309.  
  310.  
  311.     A bit field is denoted by the legend:
  312.  
  313.  
  314.             {offset:width}
  315.  
  316.  
  317. where either of the values 'offset' or 'width' can be specified within an in-
  318. struction by a constant value or a data register reference. A comparison of
  319. bit addressing (for instructions such as BCHG) and bit field addressing is:
  320.  
  321.  
  322.             7 6 5 4 3 2 1 0
  323.      Byte N-1 |    Byte N        |   Byte N+1    | Byte N+2
  324.  
  325.             Bit Addressing
  326.  
  327.  
  328.             7 6 5 4 3 2 1 0
  329.      Byte N-1 |    Byte N        |   Byte N+1    | Byte N+2
  330.                   0 1 2 3 4   5 6 7 8 9 ...
  331.             <---->
  332.             offset
  333.                   <------------------------>
  334.                     width
  335.  
  336.             Bit Field Addressing
  337.  
  338.  
  339. In the above, a Bit Field is a consecutive string of 1 to 32 bits, specified
  340. by a Base Address (the address of the byte containing Bit 0 of the Bit Field,
  341. byte N in the example above), an Offset (the distance in bits from the most
  342. significant bit of the Base Address) and the Width (number of bits that form
  343. the Bit Field).
  344.  
  345.  
  346.     If the Offset is specified using an immediate data value, then the
  347. Offset ranges from 0 to 31. Simialrly, the Width ranges from 1 to 32, but in
  348. this case the value is limited to the range 1-32 whether specified as an im-
  349. mediate value or as a data register reference.
  350.  
  351.  
  352.     When a data register is used, then the Offset specification can range
  353. from:
  354.  
  355.               31         31
  356.             -2    to    2  - 1
  357.  
  358.  
  359. which means that the first bit of the Bit Field might reside in a byte which
  360. is many bytes distant from the Base Address defined in any instruction Bit
  361. Field reference! This facility allows scanning of Bit Field Arrays, an exam-
  362. ple of which is:
  363.  
  364.  
  365.     Byte:        N        N+1        N+2      ...
  366.  
  367.     Bit : 7 6 5 4 3 2 1 0 | 7 6 5 4 3 2 1 0 | 7 6 5 4 3 2 1 0 ...
  368.  
  369.     BF  : 1 1 1 1 1 2 2 2   2 2 3 3 3 3 3 4   4 4 4 4 5 5 5 5 ...
  370.  
  371.  
  372. Here, Bit Field 2 follows Bit Field 1 in the array immediately. If Byte N is
  373. the Base Address for the entire Bit Field Array, then a data register can be
  374. used to contain the Offset, and the next element in the array referenced by
  375. adding the value of the Width (here, 5) to the value of the Offset contained
  376. in the data register, and use one address to reference the entire array with-
  377. out having to recompute the Base Address! In this case, our Bit Field Array,
  378. containing Bit Field elements of 5 bits, can contain up to 4 BILLION elements
  379. (assuming sufficient memory to store them all) all referenced via the same
  380. Base Address!
  381.  
  382.  
  383.     And by way of example, for the above Bit Field Array, if register A0
  384. of the MC68020 points to Byte N above, then the various elements are referen-
  385. ced as follows using immediate offset and width values:
  386.  
  387.  
  388.         Element #1    : (A0){0:5}
  389.  
  390.         Element #2    : (A0){5:5}
  391.  
  392.         Element #3    : (A0){10:5}
  393.  
  394.             ....
  395.  
  396.         Element #8    : 4(A0){3:5} (NOT (A0){35:5} !!!)
  397.  
  398.         Element #9    : 4(A0){8:5}
  399.  
  400.  
  401. etc.
  402.  
  403.  
  404.                MC68020 EXTRA REGISTERS
  405.                =======================
  406.  
  407.  
  408. The MC68020 possesses a number of extra registers, available to programs ex-
  409. ecuting in supervisor mode. Also, the status register contains extra bits. A
  410. summary of the registers is as follows (all registers are 32 bits wide unless
  411. otherwise stated):
  412.  
  413.  
  414.         D0 - D7 : Data Registers as per MC68000.
  415.  
  416.         A0 - A7    : Address Registers as per MC68000.
  417.  
  418.         SR    : Status Register (16 bits). See below.
  419.  
  420.         CCR    : Condition Code Register as per MC68000.
  421.  
  422.         A7'    : Also ISP : Interrupt Stack Pointer.
  423.  
  424.         A7''    : Also MSP : Master Stack Pointer.
  425.  
  426.         VBR    : Vector Base Register.
  427.  
  428.         CACR    : Cache Control Register (4 bits).
  429.  
  430.         CAAR    : Cache Address Register.
  431.  
  432.         SFC    : Source Function Code Register (3 bits).
  433.  
  434.         DFC    : Destination Function Code Register (3 bits).
  435.  
  436.  
  437. The status register bits are allocated as follows:
  438.  
  439.  
  440.         Bit    Meaning
  441.         ---    -------
  442.          0    Carry Flag (CCR).
  443.  
  444.          1    Overflow Flag (CCR).
  445.  
  446.          2    Zero Flag (CCR).
  447.  
  448.          3    Negative Flag (CCR).
  449.  
  450.          4    Extend Flag (CCR).
  451.  
  452.          8    IPL0 Interrupt Bit.
  453.  
  454.          9    IPL1 Interrupt Bit.
  455.  
  456.         10    IPL2 Interrupt Bit.
  457.  
  458.         12    Master Stack Bit.
  459.  
  460.         13    Supervisor Mode Bit.
  461.  
  462.         14    Trace On Change Of Program Flow.
  463.  
  464.         15    Trace (Single-Step Through Program).
  465.  
  466.  
  467. The Vector Base Register allows different tasks to have different sets of ex-
  468. ception vectors located in different areas of memory. The standard addresses
  469. for the MC68000 exception vectors are now treated as offsets to be added to
  470. the contents of the VBR, and when a MC68020 exception occurs, the exception
  471. vector will be fetched from this new address. When the VBR contains zero, the
  472. MC68020 operates in an identical fashion to the MC68000.
  473.  
  474.  
  475.     The Supervisor Stack Pointer (SSP) is now divided into two different
  476. entities. The Interrupt Stack Pointer (ISP) is accessed when the Master Stack
  477. Bit of the Status Register is 0 (in which case, behaviour is identical to the
  478. MC68000). When the M bit is 1, then the Master Stack Pointer is used instead
  479. of the Interrupt Stack Pointer. The MC68020 can also access the User Stack
  480. Pointer (USP) in supervisor mode via the appropriate instructions as per the
  481. MC68000, but also has available several new instructions to access the USP.
  482.  
  483.  
  484.     The Source Function Code (SFC) and Destination Function Code (DFC)
  485. Registers allow MC68020-based systems equipped with a MC68851 Paged Memory
  486. Management Unit (PMMU) to access areas of memory protected according to the
  487. definitions of the 'address space' within the PMMU. The MOVEC instruction is
  488. used to change the contents of these registers (in supervisor mode only!) to
  489. allow a supervisor-mode program to read to or write from memory protected by
  490. a PMMU. The values that these registers store are:
  491.  
  492.  
  493.         000    Undefined, Reserved.
  494.         001    User Data Space.
  495.         010    User Program Space.
  496.         011    Undefined, Reserved.
  497.         100    Undefined, Reserved.
  498.         101    Supervisor Data Space.
  499.         110    Supervisor Program Space.
  500.         111    CPU Space (see CALLM, BKPT).
  501.  
  502.  
  503.     These registers are used in conjunction with the MOVES instruction in
  504. supervisor mode to allow supervisor-mode programs to transfer data to either
  505. user program/data space or supervisor program space without causing a PMMU
  506. exception condition (memory access violation).
  507.  
  508.  
  509.     The Cache Control Register (CACR) allows the on-chip cache memory to
  510. be controlled. The bits of the CACR are:
  511.  
  512.  
  513.         Bit    Meaning
  514.         ---    -------
  515.          0    E bit : 1 = enable cache
  516.  
  517.          1    F bit : 1 = freeze cache (prevent
  518.                     updating)
  519.  
  520.          2    CE bit : 1 = invalidate single cache
  521.                      entry (CPU clears valid
  522.                      bit for entry)
  523.  
  524.          3    C bit : 1 = invalidate all cache entries
  525.  
  526.  
  527. The entries to be invalidated using the C/CE bits are controlled by the Cache
  528. Address Register (CAAR). The address of the invalidated entry is written here
  529. PRIOR to writing to the C/CE bits using MOVEC, and allows logical or virtual
  530. addresses to be invalidated prior to task switching in a multiprogramming en-
  531. vironment.
  532.  
  533.  
  534.             MC68020 EXCEPTION VECTOR TABLE
  535.             ==============================
  536.  
  537.  
  538. The MC68020 has an extended exception vector table. This vector table is de-
  539. fined by the table below. In the table, SD refers to Supervisor Data Space,
  540. and SP to Supervisor Program Space. FPCP refers to the Floating-Point Copro-
  541. cessor, and PMMU to the Paged Memory Management Unit.
  542.  
  543.  
  544.     Address    Vector    Assignment
  545.     -------    ------    ----------
  546.     $0000    0  SP    Reset:Initial ISP
  547.     $0004    1  SP    Reset:Initial PC
  548.     $0008    2  SD    Bus Error
  549.     $000C    3  SD    Address Error
  550.     $0010    4  SD    Illegal Instruction
  551.     $0014    5  SD    Zero Divide
  552.     $0018    6  SD    CHK/CHK2 Instruction
  553.     $001C    7  SD    cpTRAPcc, TRAPcc, TRAPV Instructions
  554.     $0020    8  SD    Privilege Violation
  555.     $0024    9  SD    Trace Exception
  556.     $0028    10 SD    Line-A Emulator (1010)
  557.     $002C    11 SD    Line-F Emulator (1111) & Coprocessor Instructions
  558.     $0030    12 SD    Unassigned, Reserved
  559.     $0034    13 SD    Coprocessor Protocol Violation
  560.     $0038    14 SD    Format Error
  561.     $003C    15 SD    Uninitialised Interrupt
  562.  
  563.     $0040 to   SD    Unassigned, Reserved (16-23)
  564.     $005C
  565.  
  566.     $0060    24 SD    Spurious Interrupt
  567.     $0064    25 SD    Level 1 Interrupt Autovector (IPL1)
  568.     $0068    26 SD    Level 2 Interrupt Autovector (IPL2)
  569.     $006C    27 SD    Level 3 Interrupt Autovector (IPL3)
  570.     $0070    28 SD    Level 4 Interrupt Autovector (IPL4)
  571.     $0074    29 SD    Level 5 Interrupt Autovector (IPL5)
  572.     $0078    30 SD    Level 6 Interrupt Autovector (IPL6)
  573.     $007C    31 SD    Level 7 Interrupt Autovector (IPL7)
  574.  
  575.     $0080 to   SD    TRAP 0-15 Instruction Vectors (32-47)
  576.     $00BC
  577.  
  578.     $00C0    48 SD    FPCP Branch Or Set on Unordered Condition
  579.     $00C4    49 SD    FPCP Inexact Result
  580.     $00C8    50 SD    FPCP Divide By Zero
  581.     $00CC    51 SD    FPCP Underflow
  582.     $00D0    52 SD    FPCP Operand Error
  583.     $00D4    53 SD    FPCP Overflow
  584.     $00D8    54 SD    FPCP Signalling NAN (Not-A-Number)
  585.     $00DC    55 SD    Unassigned, Reserved
  586.     $00E0    56 SD    PMMU Configuration Error
  587.     $00E4    57 SD    PMMU Illegal Operation
  588.     $00E8    58 SD    PMMU Access Level Violation
  589.  
  590.     $00EC to   SD    Unassigned, Reserved (59-63)
  591.     $00FC
  592.  
  593.     $0100 to   SD    User Defined Vectors (64 to 255)
  594.     $03FC
  595.  
  596.  
  597. Special exception vectors new to the MC68020 include the cpTRAPcc and TRAPcc
  598. instruction vector (shared with the MC68000 TRAPV vector) for handling those
  599. instructions, and the range of coprocessor handling exceptions. These include
  600. execptions for the MC68881/MC68882 mathematics coprocessor (FPCP), and the
  601. MC68851 Paged Memory Management Unit (PMMU).
  602.  
  603.  
  604.     The MC68020 now saves exception-generated data on the ISP or MSP in
  605. the form of Stack Frames. These take a number of formats, and if the MC68020
  606. encounters a Stack Frame that does not conform to these formats, then the CPU
  607. takes the Format Error exception. This can be triggered by an illegal format
  608. encountered during RTE, CALLM/RTM or cpRESTORE. This occurs if the Format
  609. field (see below) does not conform to the expected specifications.
  610.  
  611.  
  612.     The handling of the F-line exception changes in systems containing a
  613. MC68020 plus one or more coprocessors. In such systems, the exception is ta-
  614. ken only if the coprocessor(s) do not recognise an instruction passed to them
  615. unless one of the coprocessor-specific exceptions occurs.
  616.  
  617.  
  618.     Also changed is the Address Error handling-now, an address error only
  619. occurs when an attempt is made to execute an instruction that is not word-al-
  620. igned. The MC68020 can access word or longword data that is not aligned, but
  621. with a degradation in performance as a result. The processor creates a Bus
  622. Error stack frame.
  623.  
  624.  
  625.     The Bus Error exception is now created by nonexistent memory, memory
  626. errors reported to the CPU by external circuitry, or memory access errors of
  627. certain types reported by a MC68851 PMMU. Some coprocessor errors can also be
  628. the cause of a Bus Error-exercise CARE!
  629.  
  630.  
  631.     Coprocessor exceptions include the Floating-Point Coprocessor (FPCP)
  632. exceptions, which include floating-point underflow/overflow, inexact result,
  633. operand error, and a condition called 'Signalling NAN'. This refers to the
  634. use of certain special values (called NANs or 'Not-A-Number's) to signal to
  635. the CPU certain special conditions not signalled via the normal routes. As
  636. well as the FPCP exeptions, there are Paged Memory Management Unit (PMMU) ex-
  637. ceptions, including illegal operation, access violation (caused by operations
  638. such as an attempt by a user-mode program to write to a memory area designa-
  639. ted as part of the supervisor data space by the PMMU, or an attempt to issue
  640. a CALLM instruction without having been granted the correct access level), &
  641. the Configuration Error exception which is caused by faults in the operating
  642. system and its memory management (the only cure for which is to abort and re-
  643. boot the operating system!).
  644.  
  645.  
  646.     The final exception does not have a vector assigned to it-because it
  647. is a complete catastrophe for the system. A double bus fault (Bus Error with-
  648. in a Bus Error exception handler, for example) is considered to be so bad for
  649. the system that the processor enters the Halted State. The ONLY way out is an
  650. external RESET!
  651.  
  652.  
  653.             MC68020 EXCEPTION STACK FRAMES
  654.             ==============================
  655.  
  656.  
  657. The MC68020 stores exception-generated data onto the ISP or MSP in the form
  658. of a Stack Frame. At least four words are stored on the stack, as follows:
  659.  
  660.  
  661.         SP    Status Register
  662.  
  663.         SP+2    Program Counter High Word
  664.  
  665.         SP+4    Program Counter Low Word
  666.  
  667.         SP+6    Format Word
  668.  
  669.  
  670. The Format Word is defined by:
  671.  
  672.  
  673.         F F F F V V V V V V V V V V V V
  674.  
  675.  
  676. where FFFF is the format type field, and VVVV... is the Vector Offset field,
  677. identifying the exception number taken. Legal values for the FFFF field, and
  678. the number of words saved on the stack, are:
  679.  
  680.  
  681.         0000    Short Format (4 words)
  682.         0001    Throwaway Format (4 words)
  683.         0010    Instruction Exception (6 words)
  684.         0011 to Unassigned, Reserved
  685.         0111
  686.         1000    MC68010 Bus Fault (29 words)
  687.         1001    Coprocessor Mid-Instruction (10 words)
  688.         1010    MC68020 Short Bus Fault (16 words)
  689.         1011    MC68020 Long Bus Fault (46 words)
  690.         1100 to Unassigned, Reserved
  691.         1111
  692.  
  693. For example, the Format $02 Stack Frame is defined by:
  694.  
  695.  
  696.         SP    Value of SR
  697.         SP+2    Value of PC High Word
  698.         SP+4    Value of PC Low Word
  699.         SP+6    Format Word
  700.         SP+8    Instruction Address High Word
  701.         SP+10    Instruction Address Low Word
  702.  
  703.  
  704. The next stack frames to be defined are the MC68020 Short Bus-Cycle Fault or
  705. Format $0A Frame, and the Long-Frame Bus-Cycle Fault (or Format $0B) Frame.
  706. First, the Format $0A Frame:
  707.  
  708.  
  709.         SP    Value of SR
  710.         SP+2    Program Counter (2 words)
  711.         SP+6    Format Word $AXXX
  712.         SP+8    Internal Register Value
  713.         SP+10    Special Status Word
  714.         SP+12    Instruction Pipe Stage C
  715.         SP+14    Instruction Pipe Stage B
  716.         SP+16    Data Cycle Fault Address (2 words)
  717.         SP+20    Internal Register Value
  718.         SP+22    Internal Register Value
  719.         SP+24    Data Output Buffer (2 words)
  720.         SP+28    Internal Register Value
  721.         SP+30    Internal Register Value
  722.  
  723.  
  724. and finally, the Format $0B Frame:
  725.  
  726.  
  727.         SP    Value of SR
  728.         SP+2    Program Counter (2 words)
  729.         SP+6    Format Word $BXXX
  730.         SP+8    Internal Register Value
  731.         SP+10    Special Status Word
  732.         SP+12    Instruction Pipe Stage C
  733.         SP+14    Instruction Pipe Stage B
  734.         SP+16    Data Cycle Fault Address (2 words)
  735.         SP+20    Internal Registers (2 words)
  736.         SP+24    Data Output Buffer (2 words)
  737.         SP+28    Internal Registers (4 words)
  738.         SP+36    Stage B Address (2 words)
  739.         SP+40    Internal Registers (2 words)
  740.         SP+44    Data Input Buffer (2 words)
  741.         SP+48    Internal Registers (22 words!)
  742.  
  743.  
  744. Information on the MC68010 Bus-Cycle Fault Format Stack Frame can be found in
  745. the official Motorola MC68010 User's Manual, but is not of great use here.
  746.  
  747.  
  748.               MC68020 INSTRUCTION EXTENSION WORDS
  749.               ===================================
  750.  
  751.  
  752. The MC68020 extends the range of MC68000 instructions by using a range of ex-
  753. tension words to the basic instructions. The format of a typical MC68020 in-
  754. struction is:
  755.  
  756.  
  757.         Word 1 : x x x x x x x x x x M M M R R R
  758.  
  759.         Word 2 : Extension word
  760.  
  761.         Word 3 : Any extra required operand words
  762.  
  763.          ...
  764.  
  765.  
  766. where the extra operand words follow in the order:source operands first, des-
  767. tination operands next.
  768.  
  769.  
  770.     Here, the MMM and RRR fields determine the addressing mode of the in-
  771. struction in accordance with the following table (applicable to ALL Motorola
  772. MC680x0 processors unless otherwise stated):
  773.  
  774.  
  775.     MMM    RRR    Mode
  776.     ---    ---    ----
  777.     000    xxx    Data Register Direct : xxx = register number 0-7
  778.             and operand is one of D0 - D7.
  779.  
  780.     001    xxx    Address Register Direct : xxx = register number 0-7
  781.             and operand is one of A0 - A7.
  782.  
  783.     010    xxx    Address Register Indirect : xxx = 0 to 7,
  784.             operand is one of (A0) to (A7).
  785.  
  786.     011    xxx    Postincrement:xxx = 0 to 7, operand is one
  787.             of (A0)+ to (A7)+.
  788.  
  789.     100    xxx    Predecrement:xxx = 0 to 7, operand is on
  790.             of -(A0) to -(A7).
  791.  
  792.     101    xxx    Address Register Indirect With Displacement:
  793.             xxx = 0 to 7, operand is one of
  794.             disp(A0) to disp(A7). The displacement word
  795.             follows the instruction word.
  796.  
  797.     110    xxx    Address Register Indirect With Displacement
  798.             And Index:xxx = 0 to 7, operand is one of
  799.             disp(A0,Xn) to disp(A7,Xn). The index regis-
  800.             ter Xn is specified in the extension word(s),
  801.             and the displacement follows this extension
  802.             word.
  803.  
  804.     111    000    Absolute short:address of operand follows
  805.             instruction word as one word.
  806.  
  807.     111    001    Absolute long:address of operand follows
  808.             instruction word as two words.
  809.  
  810.     111    010    Program Counter Indirect With Displacement.
  811.             The displacement follows the instruction
  812.             word as one word.
  813.  
  814.     111    011    Program Counter Indirect With Displacement
  815.             And Index (all 680x0 series), and Memory Indirect
  816.             (68020 onwards).
  817.  
  818.     111    100    Immediate Data. The immediate data follows the
  819.             instruction word, using one or two words as is
  820.             required.
  821.  
  822.  
  823. The extension words fall into two types:the brief extension word (which is a
  824. slight generalisation of the standard MC68000 extension word), and the full-
  825. format extension word (which allows memory indirect addressing modes etc).
  826.  
  827.  
  828.     First, the Brief Format extension word has the format defined by the
  829. template below:
  830.  
  831.  
  832.         D X X X W S S 0 d d d d d d d d
  833.  
  834.  
  835. The various fields in this extension word are:
  836.  
  837.  
  838.     D    : D/A Field. Specifies the index register type for
  839.           disp(An,Xn) and disp(PC,Xn).
  840.  
  841.           0 = Data Register Dn
  842.  
  843.           1 = Address Register An
  844.  
  845.     XXX    : Register number field. Specifies which register is
  846.           the specified index register, ranging from 0-7.
  847.  
  848.     W    : W/L field. Specifies whether the index register is
  849.           word sized or longword sized.
  850.  
  851.           0 = word sized (value is sign-extended during
  852.               address computation)
  853.  
  854.           1 = longword sized.
  855.  
  856.     SS    : Scale field. Determines the scale in memory indirect
  857.           and the extended form of the MC68000 disp(An,Xn)/
  858.           disp(PC,Xn) which on the MC68020 allows the use of a
  859.           scale multiplier. The values are:
  860.  
  861.           00    : Multiplier = 1
  862.  
  863.           01    : Multiplier = 2
  864.  
  865.           10    : Multiplier = 4
  866.  
  867.           11    : Multiplier = 8
  868.  
  869.           The value SS=00 corresponds to the value used in the
  870.           original MC68000 extension word. The MC68020 allows
  871.           multipliers to be used as in:
  872.  
  873.             MOVE.W    0(A0,D2.W*2),D3
  874.  
  875.     ddd..    : Displacement field. Contains the byte value of the dis-
  876.           placement used in disp(An,Xn) and disp(PC,Xn) addressing
  877.           modes. This byte is sign-extended to a LONGWORD value
  878.           during computation of the effective address (so that a
  879.           value of $80 corresponds to -128).
  880.  
  881.  
  882. The Full Format extension word is far more complex, since it must contain the
  883. complete definition of any memory indirect addressing modes used. The Full
  884. Format extension word is defined using:
  885.  
  886.  
  887.         D X X X W S S 1 B I Z Z 0 J J J
  888.  
  889.  
  890. where:
  891.  
  892.  
  893.     D    : D/A field. Specifies whether index register is
  894.           a data register or an address register.
  895.  
  896.           0 = Data Register Dn
  897.  
  898.           1 = Address Register An
  899.  
  900.     XXX    : Index Register Number 0-7.
  901.  
  902.     W    : W/L Field. Specifies:
  903.  
  904.           0 = Index register word-sized. Contents sign-
  905.               extended to longword prior to address com-
  906.               putation.
  907.  
  908.           1 = Index register longword-sized.
  909.  
  910.     SS    : Scale Factor field. Values are:
  911.  
  912.           00    : Multiplier = 1
  913.  
  914.           01    : Multiplier = 2
  915.  
  916.           10    : Multiplier = 4
  917.  
  918.           11    : Multiplier = 8
  919.  
  920.     B    : Base Suppress (BS) field.
  921.  
  922.           0 = Add contents of base address register to
  923.               base displacement.
  924.  
  925.           1 = Suppress base address register-use base
  926.               displacement only.
  927.  
  928.     I    : Index Suppress (IS) field.
  929.  
  930.           0 = Evaluate index operand and add to address
  931.  
  932.           1 = Suppress index operand, do not use.
  933.  
  934.     ZZ    : Base Displacement Size (BD SIZE) field.
  935.  
  936.           00 = Reserved.
  937.  
  938.           01 = Null Displacement.
  939.  
  940.           10 = Base Displacement Word Sized.
  941.  
  942.           11 = Base Displacement Longword Sized.
  943.  
  944.     JJJ    : Index/Indirect Selection (I/IS) Field.
  945.  
  946.           Used in conjunction with the IS bit according to
  947.           the table below. 'od' refers as always to the
  948.           Outer Displacement value.
  949.  
  950.           IS    I/IS        Operation
  951.           --    ----        ---------
  952.           0    000        No Memory Indirection
  953.           0    001        Indirect Preindex, NULL od
  954.           0    010        Indirect Preindex, word od
  955.           0    011        Indirect Preindex, long od
  956.           0    100        Reserved
  957.           0    101        Indirect Postindex, NULL od
  958.           0    110        Indirect Postindex, word od
  959.           0    111        Indirect Postindex, long od
  960.  
  961.           1    000        No Memory Indirection
  962.           1    001        Indirect, No index, NULL od
  963.           1    010        Indirect, No index, word od
  964.           1    011        Indirect, No index, long od
  965.  
  966.           1    100-111        All Reserved
  967.  
  968.  
  969. Once a Full Format extension word follows an instruction, then the Base Dis-
  970. placement words follow that word, and the Outer Displacement words follow on
  971. from those. Of course, if either the Base Displacement or the Outer Displace-
  972. ment do not exist (are NULL) then those words are omitted.
  973.  
  974.  
  975.     Note that for the MOVE instruction on the MC68020, it is possible to
  976. select both source and destination Memory Indirect operands! In this case,
  977. the order of the instruction words is as follows:
  978.  
  979.  
  980.         Word 1        : MOVE instruction
  981.  
  982.         Word 2        : Source extension full format
  983.  
  984.         Words 3,4    : Base Displacement if non-NULL,
  985.                   omitted otherwise
  986.  
  987.         Words 5,6    : Outer Displacement if non-NULL,
  988.                   omitted otherwise
  989.  
  990.         Word 7        : Destination extension full format
  991.  
  992.         Words 8,9    : Base Displacement if non-NULL,
  993.                   omitted otherwise
  994.  
  995.         Words 10,11    : Outer Displacement if non-NULL,
  996.                   omitted otherwise
  997.  
  998.  
  999. Thus a 68020 instruction can consist of as many as 11 words (!) provided that
  1000. all of the specified components exist. Needless to say, executing such a MOVE
  1001. takes rather longer than MOVE.W D0,D1, for example, but gives some indication
  1002. of the enhanced power of the new 32-bit members of the family.
  1003.  
  1004.  
  1005.         MC68020 EXTRA INSTRUCTIONS AND EXTENSIONS
  1006.         =========================================
  1007.  
  1008.             TO MC68000 INSTRUCTIONS
  1009.             =======================
  1010.  
  1011.  
  1012. Before covering specific instructions and extensions to the standard MC68000
  1013. instructions allowed by the MC68020, the following should be noted:
  1014.  
  1015.  
  1016.     1) Those instructions containing the MMM RRR fields to determine
  1017.        the addressing mode of operands retain their original format,
  1018.        extra values of those fields being used by the MC68020 to ac-
  1019.        cess new addressing modes (e.g., memory indirect). The major
  1020.        change is from the MC68000 instruction extension word for the
  1021.        indexed operands to either the MC68020 Brief Format or MC68020
  1022.        Full Format extension words (covered above);
  1023.  
  1024.     2) If there ARE changes to the instruction format, then these
  1025.        changes will be covered below.
  1026.  
  1027.  
  1028. The full list of extended and new instructions now follows.
  1029.  
  1030.  
  1031. Bcc    : Branch Conditionally (Includes BRA) (MC68020)
  1032.  
  1033.     Operation : IF condition is TRUE
  1034.             THEN
  1035.               PC + d -> PC
  1036.             ELSE
  1037.             continue normal sequential operation
  1038.  
  1039.     Assembler : Bcc <LABEL>
  1040.  
  1041.     Attributes: Size=Byte,Word,Long
  1042.  
  1043.     Description    : The conditional expression specified in the
  1044.               instruction is evaluated and the result tested.
  1045.               If the result is TRUE, then the displacement is
  1046.               sign-extended to 32 bits and added on to the
  1047.               current value of the program counter, at which
  1048.               point program execution resumes. If the result
  1049.               is FALSE, program execution continues sequen-
  1050.               tially as normal.
  1051.  
  1052.     Condition Codes : NOT AFFECTED.
  1053.  
  1054.     Instruction Format :
  1055.  
  1056.         0 1 1 0 C C C C D D D D D D D D
  1057.  
  1058.     Instruction Fields :
  1059.  
  1060.         CCCC    : Condition code field. Specifies the condi-
  1061.               tional expression to compute prior to the
  1062.               branch decision. Values are given in the
  1063.               conditional branch table in the companion
  1064.               file typed_68000.doc. A field value of 0000
  1065.               corresponds to a BRA instruction, and a
  1066.               field value of 0001 corresponds to a BSR in-
  1067.               struction (see below).
  1068.  
  1069.         DDDD..    : Displacement field. The 68020 accepts THREE
  1070.               displacement sizes. For short branches, this
  1071.               field contains the byte-sized displacement
  1072.               which is sign-extended to 32 bits prior to
  1073.               addition to the program counter.
  1074.  
  1075.               If this field contains zero (00000000) then
  1076.               the word following the instruction word con-
  1077.               tains a word-sized displacement, which is
  1078.               sign-extended to 32 bits prior to adding to
  1079.               the program counter. This mode and the prev-
  1080.               ious mode is available to ALL MC680x0 CPUs.
  1081.  
  1082.               If this field contains $FF (11111111), then
  1083.               the two words following the instruction word
  1084.               contain a longword-sized displacement to be
  1085.               added directly to the program counter. This
  1086.               mode is available to the MC68020 onwards.
  1087.  
  1088.  
  1089. BFCHG    : Test Bit Field And Change
  1090.  
  1091.     Operation : dst{off:wd} -> CCR
  1092.  
  1093.             NOT(dst{off:wd}) -> dst{off:wd}
  1094.  
  1095.     Assembler : BFCHG <ea>{off:wd}
  1096.  
  1097.     Attributes: Unsized.
  1098.  
  1099.     Description    : Test the state of the specified bit field and
  1100.               alter the condition codes accordingly. Once
  1101.               the condition codes have been duly altered,
  1102.               invert all of the specified bits of the spec-
  1103.               ified bit field.
  1104.  
  1105.     Condition Codes : X N Z V C
  1106.               - * * 0 0
  1107.  
  1108.               N : Set if the most significant bit of the
  1109.                   bit field is zero. Cleared otherwise.
  1110.  
  1111.               Z : Set if all the bits of the bit field are
  1112.                   zero. Cleared otherwise.
  1113.  
  1114.               V : Always Cleared.
  1115.  
  1116.               C : Always Cleared.
  1117.  
  1118.               X : Not Affected.
  1119.  
  1120.     Instruction Format :
  1121.  
  1122.         1 1 1 0 1 0 1 0 1 1 M M M R R R
  1123.  
  1124.         0 0 0 0 A O O O O O B W W W W W
  1125.  
  1126.     Instruction Fields :
  1127.  
  1128.         MMM, RRR: See MC68020 Instruction Extension
  1129.               Words Above.
  1130.  
  1131.         A    : A = 0 if the offset is an immediate
  1132.               value, A = 1 if the offset is con-
  1133.               tained in a data register.
  1134.  
  1135.         OOO..    : Offset field. If the offset is an
  1136.               immediate value, then the value 0-31
  1137.               is stored here. If the offset is
  1138.               contained in a data register, then
  1139.               the register number D0-D7 is stored
  1140.               here.
  1141.  
  1142.         B    : B = 0 if the width is an immediate
  1143.               value. B = 1 if the width is contained
  1144.               in a data register.
  1145.  
  1146.         WWW..    : Width Field. If the width is an immed-
  1147.               iate value, then the values 0, 1-31 are
  1148.               stored here, representing a width of
  1149.               32, 1-31 respectively. If the width is
  1150.               contained in a data register, then the
  1151.               register number D0-D7 is stored here.
  1152.  
  1153.     Addressing Modes : All modes EXCEPT:
  1154.  
  1155.                An
  1156.                (An)+
  1157.                -(An)
  1158.                #<data>
  1159.  
  1160.                and PC relative modes, are allowed for the
  1161.                destination operand.
  1162.  
  1163.  
  1164. BFCLR    : Test Bit Field And Clear
  1165.  
  1166.     Operation : dst{off:wd} -> CCR
  1167.  
  1168.             0 -> dst{off:wd}
  1169.  
  1170.     Assembler : BFCLR <ea>{off:wd}
  1171.  
  1172.     Attributes: Unsized.
  1173.  
  1174.     Description    : Test the state of the specified bit field and
  1175.               alter the condition codes accordingly. Once
  1176.               the condition codes have been duly altered,
  1177.               clear all of the bits of the specified bit
  1178.               field.
  1179.  
  1180.     Condition Codes : X N Z V C
  1181.               - * * 0 0
  1182.  
  1183.               N : Set if the most significant bit of the
  1184.                   bit field is zero. Cleared otherwise.
  1185.  
  1186.               Z : Set if all the bits of the bit field are
  1187.                   zero. Cleared otherwise.
  1188.  
  1189.               V : Always Cleared.
  1190.  
  1191.               C : Always Cleared.
  1192.  
  1193.               X : Not Affected.
  1194.  
  1195.     Instruction Format :
  1196.  
  1197.         1 1 1 0 1 1 0 0 1 1 M M M R R R
  1198.  
  1199.         0 0 0 0 A O O O O O B W W W W W
  1200.  
  1201.     Instruction Fields :
  1202.  
  1203.         MMM, RRR: See MC68020 Instruction Extension
  1204.               Words Above.
  1205.  
  1206.         A    : A = 0 if the offset is an immediate
  1207.               value, A = 1 if the offset is con-
  1208.               tained in a data register.
  1209.  
  1210.         OOO..    : Offset field. If the offset is an
  1211.               immediate value, then the value 0-31
  1212.               is stored here. If the offset is
  1213.               contained in a data register, then
  1214.               the register number D0-D7 is stored
  1215.               here.
  1216.  
  1217.         B    : B = 0 if the width is an immediate
  1218.               value. B = 1 if the width is contained
  1219.               in a data register.
  1220.  
  1221.         WWW..    : Width Field. If the width is an immed-
  1222.               iate value, then the values 0, 1-31 are
  1223.               stored here, representing a width of
  1224.               32, 1-31 respectively. If the width is
  1225.               contained in a data register, then the
  1226.               register number D0-D7 is stored here.
  1227.  
  1228.     Addressing Modes : All modes EXCEPT:
  1229.  
  1230.                An
  1231.                (An)+
  1232.                -(An)
  1233.                #<data>
  1234.  
  1235.                and PC relative modes, are allowed for the
  1236.                destination operand.
  1237.  
  1238.  
  1239. BFEXTS    : Bit Field Extract Signed
  1240.  
  1241.     Operation : src{off:wd} -> Dn
  1242.  
  1243.     Assembler : BFEXTS <ea>{off:wd},Dn
  1244.  
  1245.     Attributes: Unsized
  1246.  
  1247.     Description    : Extract a bit field from the specified source
  1248.               location, sign-extend to 32 bits, and store the
  1249.               result in the specified data register.
  1250.  
  1251.     Condition Codes    : X N Z V C
  1252.               - * * 0 0
  1253.  
  1254.               N Set if the most significant bit of the bit
  1255.                 field is set. Cleared otherwise.
  1256.  
  1257.               Z Set if the bit field contains all zeros.
  1258.                 Cleared otherwise.
  1259.  
  1260.               V Always Cleared.
  1261.  
  1262.               C Always Cleared.
  1263.  
  1264.               X Not Affected.
  1265.  
  1266.     Instruction Format :
  1267.  
  1268.         1 1 1 0 1 0 1 1 1 1 M M M R R R
  1269.  
  1270.         0 D D D A O O O O O B W W W W W
  1271.  
  1272.     Instruction Fields :
  1273.  
  1274.         MMM, RRR: See MC68020 Instruction Extension Words
  1275.               above.
  1276.  
  1277.         DDD    : Destination Data Register field. Specifies
  1278.               the destination data register D0-D7.
  1279.  
  1280.         A    : A = 0 if the offset is an immediate
  1281.               value, A = 1 if the offset is con-
  1282.               tained in a data register.
  1283.  
  1284.         OOO..    : Offset field. If the offset is an
  1285.               immediate value, then the value 0-31
  1286.               is stored here. If the offset is
  1287.               contained in a data register, then
  1288.               the register number D0-D7 is stored
  1289.               here.
  1290.  
  1291.         B    : B = 0 if the width is an immediate
  1292.               value. B = 1 if the width is contained
  1293.               in a data register.
  1294.  
  1295.         WWW..    : Width Field. If the width is an immed-
  1296.               iate value, then the values 0, 1-31 are
  1297.               stored here, representing a width of
  1298.               32, 1-31 respectively. If the width is
  1299.               contained in a data register, then the
  1300.               register number D0-D7 is stored here.
  1301.  
  1302.     Addressing Modes : All modes EXCEPT:
  1303.  
  1304.                An
  1305.                (An)+
  1306.                -(An)
  1307.                #<data>
  1308.  
  1309.                are allowed for the source operand.
  1310.  
  1311.  
  1312. BFEXTU    : Bit Field Extract Unsigned
  1313.  
  1314.     Operation : src{off:wd} -> Dn
  1315.  
  1316.     Assembler : BFEXTU <ea>{off:wd},Dn
  1317.  
  1318.     Attributes: Unsized
  1319.  
  1320.     Description    : Extract a bit field from the specified source
  1321.               location, zero-extend to 32 bits, and store the
  1322.               result in the specified data register.
  1323.  
  1324.     Condition Codes    : X N Z V C
  1325.               - * * 0 0
  1326.  
  1327.               N Set if the most significant bit of the bit
  1328.                 field is set. Cleared otherwise.
  1329.  
  1330.               Z Set if the bit field contains all zeros.
  1331.                 Cleared otherwise.
  1332.  
  1333.               V Always Cleared.
  1334.  
  1335.               C Always Cleared.
  1336.  
  1337.               X Not Affected.
  1338.  
  1339.     Instruction Format :
  1340.  
  1341.         1 1 1 0 1 0 0 1 1 1 M M M R R R
  1342.  
  1343.         0 D D D A O O O O O B W W W W W
  1344.  
  1345.     Instruction Fields :
  1346.  
  1347.         MMM, RRR: See MC68020 Instruction Extension Words
  1348.               above.
  1349.  
  1350.         DDD    : Destination Data Register field. Specifies
  1351.               the destination data register D0-D7.
  1352.  
  1353.         A    : A = 0 if the offset is an immediate
  1354.               value, A = 1 if the offset is con-
  1355.               tained in a data register.
  1356.  
  1357.         OOO..    : Offset field. If the offset is an
  1358.               immediate value, then the value 0-31
  1359.               is stored here. If the offset is
  1360.               contained in a data register, then
  1361.               the register number D0-D7 is stored
  1362.               here.
  1363.  
  1364.         B    : B = 0 if the width is an immediate
  1365.               value. B = 1 if the width is contained
  1366.               in a data register.
  1367.  
  1368.         WWW..    : Width Field. If the width is an immed-
  1369.               iate value, then the values 0, 1-31 are
  1370.               stored here, representing a width of
  1371.               32, 1-31 respectively. If the width is
  1372.               contained in a data register, then the
  1373.               register number D0-D7 is stored here.
  1374.  
  1375.     Addressing Modes : All modes EXCEPT:
  1376.  
  1377.                An
  1378.                (An)+
  1379.                -(An)
  1380.                #<data>
  1381.  
  1382.                are allowed for the source operand.
  1383.  
  1384.  
  1385. BFFFO    : Bit Field Find First One
  1386.  
  1387.     Operation : src{off:wd} bit scan -> Dn
  1388.  
  1389.     Assembler : BFFFO <ea>{off:wd},Dn
  1390.  
  1391.     Attributes: Unsized
  1392.  
  1393.     Description    : Scan the specified bit field for the presence
  1394.               of a '1' bit, starting at the most significant
  1395.               bit of the bit field (the leftmost bit).
  1396.  
  1397.               If a '1' bit is found, then the bit offset of
  1398.               the first '1' bit located (which is the bit
  1399.               offset of the source operand plus the relative
  1400.               offset from the start of the bit field) is
  1401.               stored in the specified data register.
  1402.  
  1403.               If the bit field contains all zeros, then the
  1404.               value stored in the specified data register is
  1405.               the value of the source operand bit offset PLUS
  1406.               the value of the source operand field width,
  1407.               which is the offset to the next element of a
  1408.               bit field array. The condition codes are set
  1409.               according to the contents of the original bit
  1410.               field.
  1411.  
  1412.     Condition Codes    : X N Z V C
  1413.               - * * 0 0
  1414.  
  1415.               N Set if the most significant bit of the bit
  1416.                 field is 1. Cleared otherwise.
  1417.  
  1418.               Z Set if all bits of the bit field contain
  1419.                 zero. Cleared otherwise.
  1420.  
  1421.               V Always Cleared.
  1422.  
  1423.               C Always Cleared.
  1424.  
  1425.               X Not Affected.
  1426.  
  1427.     Instruction Format :
  1428.  
  1429.         1 1 1 0 1 1 0 1 1 1 M M M R R R
  1430.  
  1431.         0 D D D A O O O O O B W W W W W
  1432.  
  1433.     Instruction Fields :
  1434.  
  1435.         MMM, RRR: See MC68020 Instruction Extension Words
  1436.               above.
  1437.  
  1438.         DDD    : Destination Data Register field. Specifies
  1439.               the destination data register D0-D7.
  1440.  
  1441.         A    : A = 0 if the offset is an immediate
  1442.               value, A = 1 if the offset is con-
  1443.               tained in a data register.
  1444.  
  1445.         OOO..    : Offset field. If the offset is an
  1446.               immediate value, then the value 0-31
  1447.               is stored here. If the offset is
  1448.               contained in a data register, then
  1449.               the register number D0-D7 is stored
  1450.               here.
  1451.  
  1452.         B    : B = 0 if the width is an immediate
  1453.               value. B = 1 if the width is contained
  1454.               in a data register.
  1455.  
  1456.         WWW..    : Width Field. If the width is an immed-
  1457.               iate value, then the values 0, 1-31 are
  1458.               stored here, representing a width of
  1459.               32, 1-31 respectively. If the width is
  1460.               contained in a data register, then the
  1461.               register number D0-D7 is stored here.
  1462.  
  1463.     Addressing Modes : All modes EXCEPT:
  1464.  
  1465.                An
  1466.                (An)+
  1467.                -(An)
  1468.                #<data>
  1469.  
  1470.                are allowed for the source operand.
  1471.  
  1472.  
  1473. BFINS    : Bit Field Insert
  1474.  
  1475.     Operation : Dn -> dst{off:wd}
  1476.  
  1477.     Assembler : BFINS Dn,<ea>{off:wd}
  1478.  
  1479.     Attributes: Unsized
  1480.  
  1481.     Description    : Move a bit field from the low-order bits of the
  1482.               specified data register and store the bits in
  1483.               the bit field specified by the destination lo-
  1484.               cation. The condition codes are set according to
  1485.               the FINAL STATE of the bit field after insertion.
  1486.  
  1487.     Condition Codes    : X N Z V C
  1488.               - * * 0 0
  1489.  
  1490.               N Set if the most significant bit of the resul-
  1491.                 tant bit field is set. Cleared otherwise.
  1492.  
  1493.               Z Set if the resultant bit field contains all
  1494.                 zeros. Cleared otherwise.
  1495.  
  1496.               V Always Cleared.
  1497.  
  1498.               C Always Cleared.
  1499.  
  1500.               X Not Affected.
  1501.  
  1502.     Instruction Format :
  1503.  
  1504.         1 1 1 0 1 1 1 1 1 1 M M M R R R
  1505.  
  1506.         0 D D D A O O O O O B W W W W W
  1507.  
  1508.     Instruction Fields :
  1509.  
  1510.         MMM, RRR: See MC68020 Instruction Extension Words
  1511.               above.
  1512.  
  1513.         DDD    : Destination Data Register field. Specifies
  1514.               the destination data register D0-D7.
  1515.  
  1516.         A    : A = 0 if the offset is an immediate
  1517.               value, A = 1 if the offset is con-
  1518.               tained in a data register.
  1519.  
  1520.         OOO..    : Offset field. If the offset is an
  1521.               immediate value, then the value 0-31
  1522.               is stored here. If the offset is
  1523.               contained in a data register, then
  1524.               the register number D0-D7 is stored
  1525.               here.
  1526.  
  1527.         B    : B = 0 if the width is an immediate
  1528.               value. B = 1 if the width is contained
  1529.               in a data register.
  1530.  
  1531.         WWW..    : Width Field. If the width is an immed-
  1532.               iate value, then the values 0, 1-31 are
  1533.               stored here, representing a width of
  1534.               32, 1-31 respectively. If the width is
  1535.               contained in a data register, then the
  1536.               register number D0-D7 is stored here.
  1537.  
  1538.     Addressing Modes : All modes EXCEPT:
  1539.  
  1540.                An
  1541.                (An)+
  1542.                -(An)
  1543.                #<data>
  1544.  
  1545.                and PC relative modes, are allowed for the
  1546.                destination operand.
  1547.  
  1548.  
  1549. BFSET    : Test Bit Field And Set
  1550.  
  1551.     Operation : dst{off:wd} -> CCR
  1552.  
  1553.             1 -> dst{off:wd}
  1554.  
  1555.     Assembler : BFSET <ea>{off:wd}
  1556.  
  1557.     Attributes: Unsized.
  1558.  
  1559.     Description    : Test the state of the specified bit field and
  1560.               alter the condition codes accordingly. Once
  1561.               the condition codes have been duly altered,
  1562.               set all of the bits of the specified bit field
  1563.               (to 1).
  1564.  
  1565.     Condition Codes : X N Z V C
  1566.               - * * 0 0
  1567.  
  1568.               N : Set if the most significant bit of the
  1569.                   bit field is zero. Cleared otherwise.
  1570.  
  1571.               Z : Set if all the bits of the bit field are
  1572.                   zero. Cleared otherwise.
  1573.  
  1574.               V : Always Cleared.
  1575.  
  1576.               C : Always Cleared.
  1577.  
  1578.               X : Not Affected.
  1579.  
  1580.     Instruction Format :
  1581.  
  1582.         1 1 1 0 1 1 1 0 1 1 M M M R R R
  1583.  
  1584.         0 0 0 0 A O O O O O B W W W W W
  1585.  
  1586.     Instruction Fields :
  1587.  
  1588.         MMM, RRR: See MC68020 Instruction Extension
  1589.               Words Above.
  1590.  
  1591.         A    : A = 0 if the offset is an immediate
  1592.               value, A = 1 if the offset is con-
  1593.               tained in a data register.
  1594.  
  1595.         OOO..    : Offset field. If the offset is an
  1596.               immediate value, then the value 0-31
  1597.               is stored here. If the offset is
  1598.               contained in a data register, then
  1599.               the register number D0-D7 is stored
  1600.               here.
  1601.  
  1602.         B    : B = 0 if the width is an immediate
  1603.               value. B = 1 if the width is contained
  1604.               in a data register.
  1605.  
  1606.         WWW..    : Width Field. If the width is an immed-
  1607.               iate value, then the values 0, 1-31 are
  1608.               stored here, representing a width of
  1609.               32, 1-31 respectively. If the width is
  1610.               contained in a data register, then the
  1611.               register number D0-D7 is stored here.
  1612.  
  1613.     Addressing Modes : All modes EXCEPT:
  1614.  
  1615.                An
  1616.                (An)+
  1617.                -(An)
  1618.                #<data>
  1619.  
  1620.                and PC relative modes, are allowed for the
  1621.                destination operand.
  1622.  
  1623.  
  1624. BFTST    : Test Bit Field
  1625.  
  1626.     Operation : dst{off:wd} -> CCR
  1627.  
  1628.     Assembler : BFTST <ea>{off:wd}
  1629.  
  1630.     Attributes: Unsized.
  1631.  
  1632.     Description    : Test the state of the specified bit field and
  1633.               alter the condition codes accordingly.
  1634.  
  1635.     Condition Codes : X N Z V C
  1636.               - * * 0 0
  1637.  
  1638.               N : Set if the most significant bit of the
  1639.                   bit field is zero. Cleared otherwise.
  1640.  
  1641.               Z : Set if all the bits of the bit field are
  1642.                   zero. Cleared otherwise.
  1643.  
  1644.               V : Always Cleared.
  1645.  
  1646.               C : Always Cleared.
  1647.  
  1648.               X : Not Affected.
  1649.  
  1650.     Instruction Format :
  1651.  
  1652.         1 1 1 0 1 0 0 0 1 1 M M M R R R
  1653.  
  1654.         0 0 0 0 A O O O O O B W W W W W
  1655.  
  1656.     Instruction Fields :
  1657.  
  1658.         MMM, RRR: See MC68020 Instruction Extension
  1659.               Words Above.
  1660.  
  1661.         A    : A = 0 if the offset is an immediate
  1662.               value, A = 1 if the offset is con-
  1663.               tained in a data register.
  1664.  
  1665.         OOO..    : Offset field. If the offset is an
  1666.               immediate value, then the value 0-31
  1667.               is stored here. If the offset is
  1668.               contained in a data register, then
  1669.               the register number D0-D7 is stored
  1670.               here.
  1671.  
  1672.         B    : B = 0 if the width is an immediate
  1673.               value. B = 1 if the width is contained
  1674.               in a data register.
  1675.  
  1676.         WWW..    : Width Field. If the width is an immed-
  1677.               iate value, then the values 0, 1-31 are
  1678.               stored here, representing a width of
  1679.               32, 1-31 respectively. If the width is
  1680.               contained in a data register, then the
  1681.               register number D0-D7 is stored here.
  1682.  
  1683.     Addressing Modes : All modes EXCEPT:
  1684.  
  1685.                An
  1686.                (An)+
  1687.                -(An)
  1688.                #<data>
  1689.  
  1690.                are allowed for the destination operand.
  1691.  
  1692.  
  1693. BKPT    : Breakpoint (MC68020)
  1694.  
  1695.     Operation : IF Breakpoint Vector Acknowledged
  1696.             THEN
  1697.               execute returned operation word
  1698.             ELSE
  1699.               trap via illegal instruction vector
  1700.  
  1701.     Assembler : BKPT #<data>
  1702.  
  1703.     Attributes: Unsized
  1704.  
  1705.     Description    : This instruction is used in conjunction
  1706.               with external hardware support to provide
  1707.               a breakpoint function for debuggers and
  1708.               real-time emulators. As such, the opera-
  1709.               tion will be implementation dependent.
  1710.  
  1711.               Typically, this instruction will be sup-
  1712.               ported by the MC68851 Paged Memory Manage-
  1713.               Ment Unit, which contains the hardware re-
  1714.               quired to replace the overwritten instruc-
  1715.               tion word.
  1716.  
  1717.               The MC68020 generates a Breakpoint Acknow-
  1718.               edge bus cycle, with the immediate data on
  1719.               address lines A2-A4, address lines A0 and A1
  1720.               on the address bus being pulled low.
  1721.  
  1722.               The normal response to a BKPT by supporting
  1723.               hardware is to send an operation word (typi-
  1724.               cally the original replaced instruction) on
  1725.               the data lines with the DSACKx signal asser-
  1726.               ted (this is an ACTIVE LOW signal). The op-
  1727.               eration word is executed in place of the
  1728.               breakpoint instruction.
  1729.  
  1730.               For the exception response, a bus error sig-
  1731.               nal will cause the MC68020 to take the ille-
  1732.               gal instruction exception.
  1733.  
  1734.               If external support for this instruction is
  1735.               NOT provided in hardware, then the illegal
  1736.               instruction exception is taken.
  1737.  
  1738.     Condition Codes : NOT AFFECTED.
  1739.  
  1740.     Instruction Format :
  1741.  
  1742.         0 1 0 0 1 0 0 0 0 1 0 0 1 V V V
  1743.  
  1744.     Instruction Fields :
  1745.  
  1746.         VVV    : Vector field. Specified the breakpoint for which
  1747.               the processor is to request the corresponding
  1748.               operation word. Eight breakpoints from BKPT #0
  1749.               to BKPT #7 are supported by the MC68851, and
  1750.               the MC68851 can save overwritten instructions
  1751.               and replace them upon execution of the BKPT
  1752.               instruction. Other hardware support possibil-
  1753.               ities exist, but the MC68851 PMMU is THE support
  1754.               system recommended by Motorola.
  1755.  
  1756.  
  1757. BSR    : Branch To Subroutine (MC68020 onwards)
  1758.  
  1759.     Operation : SP - 4 -> SP
  1760.             PC -> (SP)
  1761.             PC + d -> PC
  1762.  
  1763.     Assembler : BSR <label>
  1764.  
  1765.     Attributes: Size=Byte, Word, Long
  1766.  
  1767.     Description    : The long word address of the instruction
  1768.               immediately following the BSR instruction
  1769.               is pushed onto the stack. The value of the
  1770.               displacement is then added to the value of
  1771.               the program counter, and program execution
  1772.               continues at this new location.
  1773.  
  1774.               For the 68020, the BSR instruction is ex-
  1775.               tended to allow longword displacements to
  1776.               be specified, allowing relative subroutine
  1777.               calls to be performed across the entire
  1778.               address space of the machine.
  1779.  
  1780.     Condition Codes : NOT AFFECTED.
  1781.  
  1782.     Instruction Format :
  1783.  
  1784.         0 1 1 0 0 0 0 1 D D D D D D D D
  1785.  
  1786.     Instruction Fields :
  1787.  
  1788.         DDDD..    : Displacement field. The 68020 accepts THREE
  1789.               displacement sizes. For short branches, this
  1790.               field contains the byte-sized displacement
  1791.               which is sign-extended to 32 bits prior to
  1792.               addition to the program counter.
  1793.  
  1794.               If this field contains zero (00000000) then
  1795.               the word following the instruction word con-
  1796.               tains a word-sized displacement, which is
  1797.               sign-extended to 32 bits prior to adding to
  1798.               the program counter. This and the previous
  1799.               mode is available to all MC680x0 CPUs.
  1800.  
  1801.               If this field contains $FF (11111111), then
  1802.               the two words following the instruction word
  1803.               contain a longword-sized displacement to be
  1804.               added directly to the program counter. This
  1805.               mode is available to the MC68020 onwards.
  1806.  
  1807.  
  1808. CALLM    : Call Module (MC68020 ONLY!)
  1809.  
  1810.     Operation : Save current module state on stack.
  1811.             Load new module state from destination.
  1812.  
  1813.     Assembler : CALLM #<data>,<ea>
  1814.  
  1815.     Attributes: Unsized.
  1816.  
  1817.     Description    : The destination effective address is the
  1818.               address of a module descriptor. A module
  1819.               frame is created at the top of the stack,
  1820.               and the current module state is saved in
  1821.               the stack frame thus reserved.
  1822.  
  1823.               A new module state is loaded from the de-
  1824.               scriptor addressed by the destination op-
  1825.               erand. Up to 255 bytes of arguments are
  1826.               passed to the new module, the size of the
  1827.               argument block being specified in the source
  1828.               immediate operand. 
  1829.  
  1830.     Condition Codes : NOT AFFECTED.
  1831.  
  1832.     Instruction Format:
  1833.  
  1834.         0 0 0 0 0 1 1 0 1 1 M M M R R R
  1835.  
  1836.         0 0 0 0 0 0 0 0 A A A A A A A A
  1837.  
  1838.     Instruction Fields:
  1839.  
  1840.         MMM, RRR: See MC68020 Instruction Extension
  1841.               Words Above.
  1842.  
  1843.         AAA...    : Argument Count field. Specifies the number
  1844.               of bytes of arguments to be transferred to
  1845.               the new module (as specified in the source
  1846.               operand). Legal values are from 0 to 255
  1847.               bytes. This same number of bytes is removed
  1848.               from the stack by the RTM instruction (see
  1849.               below).
  1850.  
  1851.     Addressing Modes : All modes EXCEPT:
  1852.  
  1853.                An
  1854.                (An)+
  1855.                -(An)
  1856.                #<data>
  1857.  
  1858.                are allowed for the destination operand.
  1859.  
  1860.  
  1861. CAS    : Compare And Swap With Operand
  1862.  
  1863.     Operation : dst - Dc -> CCR
  1864.  
  1865.             IF Z=1
  1866.             THEN
  1867.               Du -> dst
  1868.             ELSE
  1869.               dst -> Dc
  1870.  
  1871.     Assembler : CAS Dc,Du,<ea>
  1872.  
  1873.     Attributes: Size = Byte, Word, Long
  1874.  
  1875.     Description    : This instruction performs a Compare And Swap
  1876.               operation. The destination operand is com-
  1877.               pared with the contents of the data register
  1878.               containing the comparison operand (here, Dc)
  1879.               and the condition codes set accrordingly. If
  1880.               the Zero flag is set (indicating that the two
  1881.               operands have equal values), then the contents
  1882.               of the data register containing the update op-
  1883.               erand (here, Du) is moved to the destination
  1884.               location. If the Zero flag is cleared, then
  1885.               the destination operand is left unchanged, and
  1886.               its value moved to the data register used to
  1887.               store the comparison operand.
  1888.  
  1889.               This operation is performed using an indivis-
  1890.               ible read-modify-write cycle to allow synchron-
  1891.               isation of several processors. See notes below.
  1892.  
  1893.     Condition Codes : X N Z V C
  1894.  
  1895.               N : Set if the result is negative. Cleared
  1896.                   otherwise.
  1897.  
  1898.               Z : Set if the result is zero. Cleared other-
  1899.                   wise.
  1900.  
  1901.               V : Set if an overflow is generated. Cleared
  1902.                   otherwise.
  1903.  
  1904.               C : Set if a carry is generated. Cleared
  1905.                   otherwise.
  1906.  
  1907.               X : Not Affected.
  1908.  
  1909.     Instruction Format :
  1910.  
  1911.         0 0 0 0 1 Z Z 0 1 1 M M M R R R
  1912.  
  1913.         0 0 0 0 0 0 0 U U U 0 0 0 C C C
  1914.  
  1915.     Instruction Fields:
  1916.  
  1917.         MMM, RRR: See MC68020 Instruction Extension
  1918.               Words Above.
  1919.  
  1920.         ZZ    : Size field. Specifies the size of the
  1921.               operation:
  1922.  
  1923.               01 = Byte operation.
  1924.               10 = Word operation.
  1925.               11 = Long operation.
  1926.  
  1927.         UUU    : Specifies the data register to be used to
  1928.               contain the update operand to be moved to
  1929.               the destination effective address if the
  1930.               comparison is successful.
  1931.  
  1932.         CCC    : Specifies the data register to be used to
  1933.               contain the comparison operand to compare
  1934.               with the destination operand.
  1935.  
  1936.     Addressing Modes : All modes EXCEPT:
  1937.  
  1938.                Dn
  1939.                An
  1940.                #<data>
  1941.  
  1942.                and PC relative modes, are allowed for the
  1943.                destination operand.
  1944.  
  1945.     Notes : This instruction may be used to manage a linked list
  1946.         safely in a multiprocessor environment, where the
  1947.         linked list is used to manage a resource shared be-
  1948.         tween several processors and their tasks.
  1949.  
  1950.  
  1951. CAS2    : Compare And Swap Two Operands Simultaneously
  1952.  
  1953.     Operation : dst1 - Dc1 -> CCR
  1954.  
  1955.             IF Z=1
  1956.             THEN
  1957.               dst2 - Dc2 -> CCR
  1958.               IF Z=1
  1959.                   THEN
  1960.                 Du1 -> dst1
  1961.                 Du2 -> dst2
  1962.                   ELSE
  1963.                 dst1 -> Dc1
  1964.                 dst2 -> Dc2
  1965.             ELSE
  1966.               dst1 -> Dc1
  1967.               dst2 -> Dc2
  1968.  
  1969.     Assembler : CAS Dc1:Dc2,Du1:Du2,(Rn1):(Rn2)
  1970.  
  1971.     Attributes: Size = Word, Long
  1972.  
  1973.     Description    : This operation first compares the contents of
  1974.               the first compare operand and the first dest-
  1975.               ination operand, and sets the condition codes.
  1976.  
  1977.               If the Zero flag is set after this first com-
  1978.               parison, a second comparison is made, between
  1979.               the second comparison operand and the second
  1980.               destination operand, and the condition codes
  1981.               set accordingly.
  1982.  
  1983.               If the Zero flag is set after the second com-
  1984.               parison, then the contents of the two update
  1985.               operands are moved to the respective destin-
  1986.               ation operands.
  1987.  
  1988.               If either comparison fails, and the Zero flag
  1989.               is cleared, then the destination operands are
  1990.               left unmodified, and the values of the destin-
  1991.               ation operands are copied to the respective
  1992.               comparison operands.
  1993.  
  1994.               NOTE : Due to the complexity of this instruction,
  1995.               the programmer is free to specify data registers
  1996.               in the destination operands, and use them as if
  1997.               they were address registers. This is the ONLY
  1998.               instruction where such freedom is allowed! For
  1999.               example, it is legal to use:
  2000.  
  2001.                 CAS2 D0:D1,D2:D3,(D4):(D5)
  2002.  
  2003.               and use D4 and D5 as though they were address
  2004.               registers using the (An) addressing mode.
  2005.  
  2006.               This operation is performed using an indivis-
  2007.               ible read-modify-write cycle to allow synchron-
  2008.               isation of several processors. See notes below.
  2009.               
  2010.  
  2011.     Condition Codes : X N Z V C
  2012.  
  2013.               N : Set if the result is negative. Cleared
  2014.                   otherwise.
  2015.  
  2016.               Z : Set if the result is zero. Cleared other-
  2017.                   wise.
  2018.  
  2019.               V : Set if an overflow is generated. Cleared
  2020.                   otherwise.
  2021.  
  2022.               C : Set if a carry is generated. Cleared
  2023.                   otherwise.
  2024.  
  2025.               X : Not Affected.
  2026.  
  2027.     Instruction Format :
  2028.  
  2029.         0 0 0 0 1 Z Z 0 1 1 1 1 1 1 0 0
  2030.  
  2031.         A R R R 0 0 0 U U U 0 0 0 C C C
  2032.  
  2033.         B S S S 0 0 0 V V V 0 0 0 D D D
  2034.  
  2035.     Instruction Fields:
  2036.  
  2037.         MMM, RRR: See MC68020 Instruction Extension
  2038.               Words Above.
  2039.  
  2040.         ZZ    : Size field. Specifies the size of the
  2041.               operation:
  2042.  
  2043.               01 = Byte operation.
  2044.  
  2045.               10 = Word operation.
  2046.  
  2047.               11 = Long operation.
  2048.  
  2049.         A    : D/A1 field. A = 0 if the RRR field specifies
  2050.               a data register for the Rn1 operand, A = 1 if
  2051.               the RRR field specifies an address register.
  2052.  
  2053.         RRR    : Register number for the Rn1 operand above.
  2054.  
  2055.         UUU    : Specifies which data register is to be used
  2056.               for the first update operand (Du1 above).
  2057.  
  2058.         CCC    : Specifies which data register is to be used
  2059.               for the first comparison operand (Dc1 above).
  2060.  
  2061.         B    : D/A2 field. B = 0 if the SSS field specifies
  2062.               a data register for the Rn2 operand, B = 1 if
  2063.               the SSS field specifies an address register.
  2064.  
  2065.         SSS    : Register number for the Rn2 operand above.
  2066.  
  2067.         VVV    : Specifies which data register is to be used
  2068.               for the second update operand (Du2 above).
  2069.  
  2070.         DDD    : Specifies which data register is to be used
  2071.               for the second comparison operand (Dc2 above).
  2072.  
  2073.     Addressing Modes : All modes EXCEPT:
  2074.  
  2075.                Dn
  2076.                An
  2077.                (An)+
  2078.                -(An)
  2079.                #<data>
  2080.  
  2081.                and PC relative modes, are allowed for the
  2082.                destination operand.
  2083.  
  2084.     Notes : This instruction may be used to safely update a doubly-
  2085.         linked list in a multiprocessor environment where that
  2086.         list is used to manage a resource shared across several
  2087.         processors and their tasks.
  2088.  
  2089.  
  2090. CHK    : Check Register Against Bounds (MC68020)
  2091.  
  2092.     Operation : IF Dn < 0 OR Dn > <ea>
  2093.             THEN
  2094.               TRAP (CHK exception vector)
  2095.             ELSE
  2096.               continue normal execution
  2097.  
  2098.     Assembler : CHK <ea>,Dn
  2099.  
  2100.     Attributes: Size = Word, Long.
  2101.  
  2102.     Description    : The content of the data register is examined
  2103.               and compared to the upper bound stored at the
  2104.               source effective address. The upper bound is
  2105.               a twos complement integer.
  2106.  
  2107.               If the register value is less than zero, or
  2108.               greater than the upper bound, then the pro-
  2109.               cessor initiates exception processing via the
  2110.               CHK exception vector.
  2111.  
  2112.               The 68000 version of this instruction only
  2113.               allows word-sized comparisons. The instruction
  2114.               in this case is identical across both proces-
  2115.               sors (see ZZZ field below).
  2116.  
  2117.     Condition Codes : X N Z V C
  2118.               - * U U U
  2119.  
  2120.               N : Set if Dn<0, cleared if Dn> <ea>.
  2121.                   Undefined otherwise.
  2122.  
  2123.               Z : Undefined.
  2124.  
  2125.               V : Undefined.
  2126.  
  2127.               C : Undefined.
  2128.  
  2129.               X : Not Affected.
  2130.  
  2131.     Instruction Format :
  2132.  
  2133.         0 1 0 0 D D D Z Z Z R R R M M M
  2134.  
  2135.     Instruction Fields :
  2136.  
  2137.         MMM, RRR: See MC68020 Instruction Extension
  2138.               Words Above.
  2139.  
  2140.         ZZZ    : Size field. The two legal values
  2141.               are:
  2142.  
  2143.               110 : Word operation.
  2144.  
  2145.               100 : Long operation.
  2146.  
  2147.         DDD    : Data Register field. Specifies the data
  2148.               register to use for the destination op-
  2149.               erand.
  2150.  
  2151.  
  2152.     Addressing Modes : All modes EXECPT An (address register
  2153.                direct) are allowed.
  2154.  
  2155.  
  2156. CHK2    : Check Register Against Bounds Pair And TRAP
  2157.  
  2158.     Operation : IF Dn < <ea lower bound>
  2159.             OR
  2160.                Dn > <ea upper bound>
  2161.             THEN
  2162.               TRAP (CHK exception vector)
  2163.             ELSE
  2164.               continue normal execution
  2165.  
  2166.     Assembler : CHK2 <ea>,Rn
  2167.  
  2168.     Attributes: Size = Byte, Word, Long.
  2169.  
  2170.     Description    : The contents of the specified register (here,
  2171.               either data or address register) are compared
  2172.               with the PAIR of bounds specifiers stored at
  2173.               the source effective address in the order:
  2174.  
  2175.                 <ea>    : Lower Bound
  2176.                 <ea+N>    : Upper Bound
  2177.  
  2178.               where N is the size of the operand.
  2179.  
  2180.               If the value of the specified register is less
  2181.               than the value of the lower bound, or greater
  2182.               than the value of the upper bound, then an ex-
  2183.               ception is taken via the CHK exception vector.
  2184.               If the value lies within the specified bounds,
  2185.               then execution continues as normal.
  2186.  
  2187.               If the destination register is a data register,
  2188.               then the comparison only affects that portion of
  2189.               the data register whose size is specified.
  2190.  
  2191.               If the destination register is an address regi-
  2192.               ster, then the bounds values are sign-extended
  2193.               to 32 bits before the comparison is performed. 
  2194.  
  2195.               Note:either a signed or an unsigned comparison
  2196.               can be performed. For signed comparisons, the
  2197.               lower bound should be arithmetically smaller,
  2198.               and for unsigned comparisons, the lower bound
  2199.               should be logically smaller.
  2200.  
  2201.     Condition Codes : X N Z V C
  2202.               - U * U *
  2203.  
  2204.               N : Undefined.
  2205.  
  2206.               Z : Set if Rn is equal to either bound. Cleared
  2207.                   otherwise.
  2208.  
  2209.               V : Undefined.
  2210.  
  2211.               C : Set if Rn is out of bounds. Cleared other-
  2212.                   wise.
  2213.  
  2214.               X : Not Affected.
  2215.  
  2216.     Instruction Format :
  2217.  
  2218.         0 0 0 0 0 Z Z 0 1 1 M M M R R R
  2219.  
  2220.         A D D D 1 0 0 0 0 0 0 0 0 0 0 0
  2221.  
  2222.     Instruction Fields :
  2223.  
  2224.         MMM, RRR: See MC68020 Instruction Extension
  2225.               Words Above.
  2226.  
  2227.         ZZ    : Size field. The two legal values
  2228.               are:
  2229.  
  2230.               01 : Byte operation.
  2231.  
  2232.               10 : Word operation.
  2233.  
  2234.               11 : Long operation.
  2235.  
  2236.         A    : D/A field. A = 0 if the register to be checked
  2237.               is a data register, A = 1 if the register to be
  2238.               checked is an address register.
  2239.  
  2240.         DDD    : Register field. Specifies the data or address
  2241.               register to use for the destination operand.
  2242.  
  2243.  
  2244.     Addressing Modes : All modes EXECPT:
  2245.  
  2246.                Dn
  2247.                An
  2248.                (An)+
  2249.                -(An)
  2250.                #<data>
  2251.  
  2252.                are allowed for the source operand.
  2253.  
  2254.  
  2255. CMP2    : Check Register Against Bounds Pair
  2256.  
  2257.     Operation : Compare Rn against upper & lower bounds -> CCR
  2258.  
  2259.     Assembler : CHK2 <ea>,Rn
  2260.  
  2261.     Attributes: Size = Byte, Word, Long.
  2262.  
  2263.     Description    : The contents of the specified register (here,
  2264.               either data or address register) are compared
  2265.               with the PAIR of bounds specifiers stored at
  2266.               the source effective address in the order:
  2267.  
  2268.                 <ea>    : Lower Bound
  2269.                 <ea+N>    : Upper Bound
  2270.  
  2271.               where N is the size of the operand.
  2272.  
  2273.               If the destination register is a data register,
  2274.               then the comparison only affects that portion of
  2275.               the data register whose size is specified.
  2276.  
  2277.               If the destination register is an address regi-
  2278.               ster, then the bounds values are sign-extended
  2279.               to 32 bits before the comparison is performed. 
  2280.  
  2281.               Note:either a signed or an unsigned comparison
  2282.               can be performed. For signed comparisons, the
  2283.               lower bound should be arithmetically smaller,
  2284.               and for unsigned comparisons, the lower bound
  2285.               should be logically smaller.
  2286.  
  2287.               This instruction is analogous to CHK2, but is
  2288.               provided to allow comparisons without the need
  2289.               for exception processing.
  2290.  
  2291.     Condition Codes : X N Z V C
  2292.               - U * U *
  2293.  
  2294.               N : Undefined.
  2295.  
  2296.               Z : Set if Rn is equal to either bound. Cleared
  2297.                   otherwise.
  2298.  
  2299.               V : Undefined.
  2300.  
  2301.               C : Set if Rn is out of bounds. Cleared other-
  2302.                   wise.
  2303.  
  2304.               X : Not Affected.
  2305.  
  2306.     Instruction Format :
  2307.  
  2308.         0 0 0 0 0 Z Z 0 1 1 M M M R R R
  2309.  
  2310.         A D D D 0 0 0 0 0 0 0 0 0 0 0 0
  2311.  
  2312.     Instruction Fields :
  2313.  
  2314.         MMM, RRR: See MC68020 Instruction Extension
  2315.               Words Above.
  2316.  
  2317.         ZZ    : Size field. The two legal values
  2318.               are:
  2319.  
  2320.               01 : Byte operation.
  2321.  
  2322.               10 : Word operation.
  2323.  
  2324.               11 : Long operation.
  2325.  
  2326.         A    : D/A field. A = 0 if the register to be checked
  2327.               is a data register, A = 1 if the register to be
  2328.               checked is an address register.
  2329.  
  2330.         DDD    : Register field. Specifies the data or address
  2331.               register to use for the destination operand.
  2332.  
  2333.  
  2334.     Addressing Modes : All modes EXECPT:
  2335.  
  2336.                Dn
  2337.                An
  2338.                (An)+
  2339.                -(An)
  2340.                #<data>
  2341.  
  2342.                are allowed for the source operand.
  2343.  
  2344.  
  2345. cpBcc    : Branch On Coprocessor Condition
  2346.  
  2347.     Operation : If cpcc = TRUE
  2348.             THEN
  2349.               PC + d -> PC
  2350.             ELSE
  2351.               continue normal execution
  2352.  
  2353.     Assembler : cpBcc <label>
  2354.  
  2355.     Attributes: Size = Word, Long
  2356.  
  2357.     Description    : If the specified coprocessor condition is
  2358.               true, then the value of the displacement
  2359.               is added onto the value of the program
  2360.               counter, and execution continues at this
  2361.               new location. If the specified coprocessor
  2362.               condition is false, then execution contin-
  2363.               ues at the next instruction in sequence.
  2364.  
  2365.               If the branch is a word branch, then the
  2366.               displacement is sign-extended to 32 bits
  2367.               before being added to the PC.
  2368.  
  2369.     Condition Codes : NOT AFFECTED.
  2370.  
  2371.     Instruction Format :
  2372.  
  2373.         1 1 1 1 I I I 0 1 W C C C C C C
  2374.  
  2375.         X X X X X X X X X X X X X X X X
  2376.  
  2377.     Instruction Fields :
  2378.  
  2379.         III    : Coprocessor ID field. Specifies the
  2380.               coprocessor that is to perform this
  2381.               operation.
  2382.  
  2383.               Current values:
  2384.  
  2385.               000 = MC68851 Paged Memory Management Unit
  2386.  
  2387.               001 = MC6881/68882 Mathematics Coprocessor
  2388.  
  2389.         W    : W/L field. W = 0 specifies a word-length
  2390.               branch, W = 1 specifies a longword-length
  2391.               branch.
  2392.  
  2393.         CCC...    : Coprocessor condition field. Contains the
  2394.               condition specification for the given co-
  2395.               processor. This field is passed to the
  2396.               coprocessor, which provides directives to
  2397.               the CPU for processing this instruction.
  2398.  
  2399.         XXX...    : Optional Coprocessor Defined Extension Word(s)
  2400.  
  2401.         Following these words are either one word for a 16-bit
  2402.         branch displacement, or two words for a 32-bit displace-
  2403.         ment branch.
  2404.  
  2405.  
  2406. cpDBcc    : Test Coprocessor Condition, Decrement And Branch
  2407.  
  2408.     Operation : IF cpcc = FALSE
  2409.             THEN
  2410.               Dn - 1 -> Dn
  2411.               IF Dn <> -1
  2412.                 THEN
  2413.                   PC + d -> PC
  2414.                 ELSE
  2415.                   continue normal execution
  2416.             ELSE
  2417.               continue normal execution
  2418.  
  2419.     Assembler : cpDBcc Dn,<label>
  2420.  
  2421.     Attributes: Size = Word.
  2422.  
  2423.     Description    : If the specified coprocessor condition is true,
  2424.               then execution continues with the next instruc-
  2425.               tion. If the specified coprocessor condition is
  2426.               false, then the low order word of the specified
  2427.               data register is decremented by 1. If the result
  2428.               of this decrementation is equal to -1, execution
  2429.               continues with the next instruction. Otherwise
  2430.               the 16-bit displacement is sign-extended to 32
  2431.               bits and added on to the program counter, and ex-
  2432.               ecution continues at this new location.
  2433.  
  2434.     Condition Codes : NOT AFFECTED.
  2435.  
  2436.     Instruction Format :
  2437.  
  2438.         1 1 1 1 I I I 0 0 1 0 0 1 D D D
  2439.  
  2440.         0 0 0 0 0 0 0 0 0 0 C C C C C C
  2441.  
  2442.         X X X X X X X X X X X X X X X X
  2443.  
  2444.     Instruction Fields :
  2445.  
  2446.         III    : Coprocessor ID field. Specifies the coprocesor
  2447.               that is to process this operation. See cpBcc
  2448.               above for current coprocessor IDs.
  2449.  
  2450.         DDD    : Data Register field. Specifies the data regis-
  2451.               ter to be used as the counter.
  2452.  
  2453.         CCC...    : Coprocessor condition field. Contains the
  2454.               condition specification for the given co-
  2455.               processor. This field is passed to the
  2456.               coprocessor, which provides directives to
  2457.               the CPU for processing this instruction.
  2458.  
  2459.         XXX...    : Optional Coprocessor Defined Extension Word(s).
  2460.  
  2461.         Following these words is a 16-bit word containing the
  2462.         displacement to be used.
  2463.  
  2464.  
  2465. cpGEN    : Coprocessor General Function.
  2466.  
  2467.     Operation : Pass Command Word To Coprocessor.
  2468.  
  2469.     Assembler : cpGEN <parameters>
  2470.  
  2471.             <parameters> as defined by given coprocessor
  2472.  
  2473.     Attributes: Unsized.
  2474.  
  2475.     Description    : This instruction is used by coprocessors to
  2476.               specify the general data movement and data
  2477.               processing operations for the specified co-
  2478.               processor. The coprocessor determines the
  2479.               operation from the Coprocessor Command Word
  2480.               immediately following the cpGEN command word.
  2481.  
  2482.               Usually, a coprocessor defines specific ins-
  2483.               tances of this instruction to provide its in-
  2484.               struction set.
  2485.  
  2486.     Condition Codes : Determined By Coprocessor. Unchanged Otherwise.
  2487.  
  2488.     Instruction Format :
  2489.  
  2490.         1 1 1 1 I I I 0 0 0 M M M R R R
  2491.  
  2492.         C C C C C C C C C C C C C C C C
  2493.  
  2494.         X X X X X X X X X X X X X X X X
  2495.  
  2496.     Instruction Fields :
  2497.  
  2498.         III    : Coprocessor ID field. Specifies the coprocesor
  2499.               that is to process this operation. See cpBcc
  2500.               above for current coprocessor IDs.
  2501.  
  2502.         MMM, RRR: See MC68020 Instruction Extension Words Above.
  2503.               Used to specify an operand in main memory for
  2504.               the coprocessor operation if specified, or
  2505.               the CPU registers.
  2506.  
  2507.         CCC...    : Coprocessor Command Field. Specifies the co-
  2508.               processor instruction to be performed.
  2509.  
  2510.         XXX...    : Optional Coprocessor Defined Extension Word(s).
  2511.  
  2512.  
  2513. cpRESTORE    : Restore Coprocessor Machine State
  2514.  
  2515.           (PRIVIEGED INSTRUCTION)
  2516.  
  2517.     Operation : IF supervisor state
  2518.             THEN
  2519.               Restore Coprocessor Machine State
  2520.             ELSE
  2521.               TRAP (Privilege Violation).
  2522.  
  2523.     Assembler : cpRESTORE <ea>
  2524.  
  2525.     Attributes: Unsized.
  2526.  
  2527.     Description    : If the CPU is in supervisor mode, then restore
  2528.               the machine state of the coprocessor as saved
  2529.               earlier by a cpSAVE instruction (see below).
  2530.               If the CPU is in user mode, take the Privilege
  2531.               Violation exception.
  2532.  
  2533.     Condition Codes : NOT AFFECTED.
  2534.  
  2535.     Instruction Format :
  2536.  
  2537.         1 1 1 1 I I I 1 0 1 M M M R R
  2538.  
  2539.     Instruction Fields :
  2540.  
  2541.         III    : Coprocessor ID field. Specifies the coprocesor
  2542.               that is to process this operation. See cpBcc
  2543.               above for current coprocessor IDs.
  2544.  
  2545.         MMM, RRR: See MC68020 Instruction Extension Words Above.
  2546.               Used to specify the effective address of the
  2547.               saved coprocessor state to restore.
  2548.  
  2549.     Addressing Modes : All EXECPT:
  2550.  
  2551.                Dn
  2552.                An
  2553.                -(An)
  2554.                #<data>
  2555.  
  2556.                are allowed for the effective address operand.
  2557.  
  2558.     Notes : If the coprocessor passes a communication format word
  2559.         of the 'come again' form for continued processing,
  2560.         pending interrupts are not serviced. It is the PRO-
  2561.         GRAMMER'S responsibility to take account of this!
  2562.  
  2563.  
  2564. cpSAVE    : Save Coprocessor Machine State
  2565.  
  2566.       (PRIVILEGED INSTRUCTION)
  2567.  
  2568.     Operation : IF supervisor state
  2569.             THEN
  2570.               Save Coprocessor Machine State
  2571.             ELSE
  2572.               TRAP (Privilege Violation).
  2573.  
  2574.     Assembler : cpSAVE <ea>
  2575.  
  2576.     Attributes: Unsized.
  2577.  
  2578.     Description    : If the CPU is in the supervisor mode, then
  2579.               save the entire machine state of the speci-
  2580.               fied coprocessor at the destination effec-
  2581.               tive address. If the CPU is in user mode,
  2582.               then take the Privilege Violation exception.
  2583.  
  2584.     Condition Codes : NOT AFFECTED.
  2585.  
  2586.     Instruction Format :
  2587.  
  2588.         1 1 1 1 I I I 1 0 0 M M M R R R
  2589.  
  2590.     Instruction Fields :
  2591.  
  2592.         III    : Coprocessor ID field. Specifies the coprocesor
  2593.               that is to process this operation. See cpBcc
  2594.               above for current coprocessor IDs.
  2595.  
  2596.         MMM, RRR: See MC68020 Instruction Extension Words Above.
  2597.               Used to specify the effective address of the
  2598.               saved coprocessor state to restore.
  2599.  
  2600.     Addressing Modes : All EXECPT:
  2601.  
  2602.                Dn
  2603.                An
  2604.                (An)+
  2605.                #<data>
  2606.  
  2607.                are allowed for the effective address operand.
  2608.  
  2609.  
  2610. cpScc    : Set On Coprocessor Condition
  2611.  
  2612.     Operation : IF cpcc = TRUE
  2613.             THEN
  2614.               1111...111 -> dst
  2615.             ELSE
  2616.               0000...000 -> dst
  2617.  
  2618.     Assembler : cpScc <ea>
  2619.  
  2620.     Attributes: Size = Byte.
  2621.  
  2622.     Description    : Test the specified coprocessor condition. If
  2623.               the condition is TRUE, set all bits of the
  2624.               byte destination operand. If the condition
  2625.               is FALSE, clear all bits of the byte desti-
  2626.               nation operand.
  2627.  
  2628.     Condition Codes : NOT FFFECTED.
  2629.  
  2630.     Instruction Format :
  2631.  
  2632.         1 1 1 1 I I I 0 0 1 M M M R R R
  2633.  
  2634.         0 0 0 0 0 0 0 0 0 0 C C C C C C
  2635.  
  2636.         X X X X X X X X X X X X X X X X
  2637.  
  2638.     Instruction Fields :
  2639.  
  2640.         III    : Coprocessor ID field. Specifies the coprocesor
  2641.               that is to process this operation. See cpBcc
  2642.               above for current coprocessor IDs.
  2643.  
  2644.         MMM, RRR: See MC68020 Instruction Extension Words Above.
  2645.               Used to specify an operand in main memory for
  2646.               the coprocessor operation if specified, or
  2647.               the CPU registers.
  2648.  
  2649.         CCC...    : Coprocessor Condition Field. Specifies the co-
  2650.               processor condition to be tested.
  2651.  
  2652.         XXX...    : Optional Coprocessor Defined Extension Word(s).
  2653.  
  2654.     Addressing Modes : All EXECPT:
  2655.  
  2656.                An
  2657.                #<data>
  2658.  
  2659.                are allowed for the effective address operand.
  2660.  
  2661.  
  2662. cpTRAPcc    : Trap On Coprocessor Condition.
  2663.  
  2664.     Operation : IF cpcc = TRUE
  2665.             THEN
  2666.               TRAP (cpTRAP exception vector)
  2667.             ELSE
  2668.               continue normal execution.
  2669.  
  2670.     Assembler : cpTRAPcc #<data>
  2671.  
  2672.     Attributes: Unsized or Size = Word.
  2673.  
  2674.     Description    : If the selected coprocessor condition is true,
  2675.               then the CPU initiates exception processing.
  2676.               The vector number is generated to reference the
  2677.               TRAPV/TRAPcc exception vector, and the stacked
  2678.               value of the program counter is the address of
  2679.               the next instruction. If the selected condition
  2680.               is false, then execution continues with the next
  2681.               instruction. Following the condition word and
  2682.               any coprocessor defined extension words is a
  2683.               user-defined data operand specified as immediate
  2684.               data, to be used by the trap handler.
  2685.  
  2686.     Condition Codes : NOT AFFECTED.
  2687.  
  2688.     Instuction Format :
  2689.  
  2690.         1 1 1 1 I I I 0 0 1 1 1 1 M M M
  2691.  
  2692.         0 0 0 0 0 0 0 0 0 0 C C C C C C
  2693.  
  2694.         X X X X X X X X X X X X X X X X
  2695.  
  2696.     Instruction Fields :
  2697.  
  2698.         III    : Coprocessor ID field. Specifies the coprocesor
  2699.               that is to process this operation. See cpBcc
  2700.               above for current coprocessor IDs.
  2701.  
  2702.         MMM    : Op-Mode field. Specifies the instruction form.
  2703.  
  2704.               010 : Instruction is followed by one operand
  2705.                 word.
  2706.  
  2707.               011 : Instruction is followed by two operand
  2708.                 words.
  2709.  
  2710.               100 : Instruction has no operand words.
  2711.  
  2712.         CCC...    : Coprocessor Condition field. Specifies the co-
  2713.               processor condition to be tested.
  2714.  
  2715.         XXX...    : Optional Coprocessor Defined Extension Word(s).
  2716.  
  2717.         If the Op-Mode field specifies one or two immediate data
  2718.         operand words, then the operand words follow the optional
  2719.         coprocessor defined extension words.
  2720.  
  2721.  
  2722. DIVSL    : Divide Signed Long.
  2723.  
  2724.     Operation : dst/src -> dst
  2725.  
  2726.     Assembler : DIVS.L <ea>,Dq    ;32/32 -> 32r
  2727.             DIVS.L <ea>,Dr:Dq    ;64/32 -> 32r:32q
  2728.             DIVSL.L <ea>,Dr:Dq    ;32/32 -> 32r:32q
  2729.  
  2730.     Attributes: Size = Word, Long.
  2731.  
  2732.     Description    : Divide the destination operand by the source
  2733.               operand, and store the result in the destina-
  2734.               tion. The operation is performed using signed
  2735.               arithmetic.
  2736.  
  2737.               The first long form operates on a 32-bit divi-
  2738.               dend (the destination) and a 32-bit divisor
  2739.               (the source). The result is a 32-bit quotient
  2740.               stored in the destination, and the remainder
  2741.               is discarded.
  2742.  
  2743.               The second long form operates on a 64-bit divi-
  2744.               dend (the destination) and a 32-bit divisor (the
  2745.               source). The result is a 32-bit quotient and a
  2746.               32-bit remainder.
  2747.  
  2748.               The third long form operates on a 32-bit divi-
  2749.               dend (the destination) and a 32-bit divisor (the
  2750.               source). The result is a 32-bit quotient and a
  2751.               32-bit remainder.
  2752.  
  2753.               Two special conditions may arise:
  2754.  
  2755.               1) Division by zero : take the Zero Divide
  2756.                  exception.
  2757.  
  2758.               2) Overflow detected & set before completion
  2759.                  of the instruction. If this occurs, then
  2760.                  the destination operand(s) are not affected.
  2761.  
  2762.     Condition Codes : X N Z V C
  2763.               - * * * 0
  2764.  
  2765.               N : Set if the quotient is negative. Undefined if
  2766.                   overflow or divide by zero.
  2767.  
  2768.               Z : Set if the quotient is zero. Cleared otherwise.
  2769.                   Undefined if overflow or divide by zero.
  2770.  
  2771.               V : Set if division overflow is detected. Cleared
  2772.                   otherwise.
  2773.  
  2774.               C : Always Cleared.
  2775.  
  2776.               X : Not Affected.
  2777.  
  2778.     Instruction Format :
  2779.  
  2780.         0 1 0 0 1 1 0 0 0 1 M M M R R R
  2781.  
  2782.         0 Q Q Q 1 Z 0 0 0 0 0 0 0 D D D
  2783.  
  2784.     Instruction Fields :
  2785.  
  2786.         MMM, RRR: See MC68020 Instruction Extension Words Above.
  2787.  
  2788.         QQQ    : Specifies the data register used to hold the
  2789.               quotient.
  2790.  
  2791.         Z    : Size field. Selects a 32-bit or 64-bit dividend.
  2792.  
  2793.               0 = 32-bit dividend in register Dq.
  2794.  
  2795.               1 = 64-bit dividend in register Dr:Dq.
  2796.  
  2797.         DDD    : Specifies the data register used to hold the
  2798.               remainder. If Dr = Dq, then only the quotient
  2799.               is returned (1st long form). If the size
  2800.               field is 1, this specifies the data register
  2801.               containing the high 32 bits of the 64-bit divi-
  2802.               dend.
  2803.  
  2804.     Addressing Modes : All EXCEPT An are allowed for the source
  2805.                operand.
  2806.  
  2807.  
  2808. DIVUL    : Divide Unsigned Long.
  2809.  
  2810.     Operation : dst/src -> dst
  2811.  
  2812.     Assembler : DIVU.L <ea>,Dq    ;32/32 -> 32r
  2813.             DIVU.L <ea>,Dr:Dq    ;64/32 -> 32r:32q
  2814.             DIVUL.L <ea>,Dr:Dq    ;32/32 -> 32r:32q
  2815.  
  2816.     Attributes: Size = Word, Long.
  2817.  
  2818.     Description    : Divide the destination operand by the source
  2819.               operand, and store the result in the destina-
  2820.               tion. The operation is performed using unsigned
  2821.               arithmetic.
  2822.  
  2823.               The first long form operates on a 32-bit divi-
  2824.               dend (the destination) and a 32-bit divisor
  2825.               (the source). The result is a 32-bit quotient
  2826.               stored in the destination, and the remainder
  2827.               is discarded.
  2828.  
  2829.               The second long form operates on a 64-bit divi-
  2830.               dend (the destination) and a 32-bit divisor (the
  2831.               source). The result is a 32-bit quotient and a
  2832.               32-bit remainder.
  2833.  
  2834.               The third long form operates on a 32-bit divi-
  2835.               dend (the destination) and a 32-bit divisor (the
  2836.               source). The result is a 32-bit quotient and a
  2837.               32-bit remainder.
  2838.  
  2839.               Two special conditions may arise:
  2840.  
  2841.               1) Division by zero : take the Zero Divide
  2842.                  exception.
  2843.  
  2844.               2) Overflow detected & set before completion
  2845.                  of the instruction. If this occurs, then
  2846.                  the destination operand(s) are not affected.
  2847.  
  2848.     Condition Codes : X N Z V C
  2849.               - * * * 0
  2850.  
  2851.               N : Set if the quotient is negative. Undefined if
  2852.                   overflow or divide by zero.
  2853.  
  2854.               Z : Set if the quotient is zero. Cleared otherwise.
  2855.                   Undefined if overflow or divide by zero.
  2856.  
  2857.               V : Set if division overflow is detected. Cleared
  2858.                   otherwise.
  2859.  
  2860.               C : Always Cleared.
  2861.  
  2862.               X : Not Affected.
  2863.  
  2864.     Instruction Format :
  2865.  
  2866.         0 1 0 0 1 1 0 0 0 1 M M M R R R
  2867.  
  2868.         0 Q Q Q 0 Z 0 0 0 0 0 0 0 D D D
  2869.  
  2870.     Instruction Fields :
  2871.  
  2872.         MMM, RRR: See MC68020 Instruction Extension Words Above.
  2873.  
  2874.         QQQ    : Specifies the data register used to hold the
  2875.               quotient.
  2876.  
  2877.         Z    : Size field. Selects a 32-bit or 64-bit dividend.
  2878.  
  2879.               0 = 32-bit dividend in register Dq.
  2880.  
  2881.               1 = 64-bit dividend in register Dr:Dq.
  2882.  
  2883.         DDD    : Specifies the data register used to hold the
  2884.               remainder. If Dr = Dq, then only the quotient
  2885.               is returned (1st long form). If the size
  2886.               field is 1, this specifies the data register
  2887.               containing the high 32 bits of the 64-bit divi-
  2888.               dend.
  2889.  
  2890.     Addressing Modes : All EXCEPT An are allowed for the source
  2891.                operand.
  2892.  
  2893.  
  2894. EXT    : Sign Extend (MC68020).
  2895.  
  2896.     Operation : dst (sign-extend) -> dst
  2897.  
  2898.     Assembler : EXT.W Dn    ;extend byte to word
  2899.             EXT.L Dn    ;extend word to long
  2900.             EXTB.L Dn    ;extend byte to long
  2901.  
  2902.     Attributes: Size = Byte, Word, Long.
  2903.  
  2904.     Description    : Sign-extend the operand contained in the desti-
  2905.               nation data register, according to the specified
  2906.               size.
  2907.  
  2908.               EXT.W copies bit 7 to bits [15:8] of the data
  2909.               register. This instruction is available on all
  2910.               MC680x0 CPUs.
  2911.  
  2912.               EXT.L copies bit 15 to bits [31:16] of the data
  2913.               register. This instruction is avaialble on all
  2914.               MC680x0 CPUs.
  2915.  
  2916.               EXTB.L copies bit 7 to bits [31:8] of the data
  2917.               register. This instruction is avaialble on the
  2918.               MC68020 onwards.
  2919.  
  2920.               The instruction formats for EXT.W and EXT.L are
  2921.               identical to the MC68000 EXT instruction. The
  2922.               Op-Mode field provides for extensions to the
  2923.               instruction set for higher processors such as
  2924.               the MC68020.
  2925.  
  2926.     Condition Codes : X N Z V C
  2927.               - * * 0 0
  2928.  
  2929.               N : Set if the result is negative. Cleared
  2930.                   otherwise.
  2931.  
  2932.               Z : Set if the result is zero. Cleared
  2933.                   otherwise.
  2934.  
  2935.               V : Always Cleared.
  2936.  
  2937.               C : Always Cleared.
  2938.  
  2939.               X : Not Affected.
  2940.  
  2941.     Instruction Format :
  2942.  
  2943.         0 1 0 0 1 0 0 M M M 0 0 0 D D D
  2944.  
  2945.     Instruction Fields :
  2946.  
  2947.         MMM    : Op-Mode field. Specifies the size of the
  2948.               sign-extension operation.
  2949.  
  2950.               010 : sign-extend byte to word.
  2951.  
  2952.               011 : sign-extend word to long.
  2953.  
  2954.               111 : sign-extend byte to long.
  2955.  
  2956.         DDD    : Register field. Specifies which data register
  2957.               to use.
  2958.  
  2959.  
  2960. MOVEC    : Move Control Register
  2961.  
  2962.       (PRIVILEGED INSTRUCTION)
  2963.  
  2964.     Operation : IF supervisor state
  2965.             THEN
  2966.               Rc -> Rn or Rn -> Rc
  2967.             ELSE
  2968.               TRAP (Privilege Violation).
  2969.  
  2970.     Assembler : MOVEC Rc,Rn
  2971.             MOVEC Rn,Rc
  2972.  
  2973.     Attributes: Size = Long.
  2974.  
  2975.     Description    : If the CPU is in supervisor mode, then copy the
  2976.               contents of the specified control register to
  2977.               the specified general register, or copy the con-
  2978.               tents of the specified general register to the
  2979.               specified control register. If the CPU is in
  2980.               user mode, then take the Priivlege Violation ex-
  2981.               ception.
  2982.  
  2983.               The data transfer is ALWAYS a 32-bit transfer,
  2984.               even though the register may be implemented with
  2985.               fewer bits. Unimplemented bits are read as zeros
  2986.               and ignored when written.
  2987.  
  2988.     Condition Codes : NOT AFFECTED.
  2989.  
  2990.     Instuction Format :
  2991.  
  2992.         0 1 0 0 1 1 1 0 0 1 1 1 1 0 1 D
  2993.  
  2994.         A R R R C C C C C C C C C C C C
  2995.  
  2996.     Instruction Fields :
  2997.  
  2998.         D    : Dr field. Specifies the direction of data
  2999.               transfer.
  3000.  
  3001.               0 = control register to general register.
  3002.  
  3003.               1 = general register to control register.
  3004.  
  3005.         A    : A/D field. Specifies the type of general
  3006.               register.
  3007.  
  3008.               0 = Data Register.
  3009.  
  3010.               1 = Address Register.
  3011.  
  3012.         RRR    : General Register field. Specifies which data
  3013.               or address register is used.
  3014.  
  3015.         CCC...    : Control Register field. Specifies the control
  3016.               register used. Values are:
  3017.  
  3018.               $000    : Source Function Code (SFC) Register.
  3019.               $001    : Destination Function Code (DFC)
  3020.                   Register.
  3021.               $002    : Cache Control Register (CACR).
  3022.               $800    : User Stack Pointer (USP).
  3023.               $801    : Vector Base Register (VBR).
  3024.               $802    : Cache Address Register (CAAR).
  3025.               $803    : Master Stack Pointer (MSP).
  3026.               $804    : Interrupt Stack Pointer (ISP).
  3027.  
  3028.               All other codes cause an illegal instruction
  3029.               exception.
  3030.  
  3031.  
  3032. MOVES    : Move Address Space
  3033.  
  3034.       (PRIVILEGED INSTRUCTION)
  3035.  
  3036.     Operation : IF supervisor state
  3037.             THEN
  3038.               Rn -> dst[DFC]
  3039.               or
  3040.               src[SFC] -> Rn
  3041.             ELSE
  3042.               TRAP (Privilege Violation).
  3043.  
  3044.     Assembler : MOVES <ea>,Rn
  3045.             MOVES Rn,<ea>
  3046.  
  3047.     Attributes: Size = Byte, Word, Long.
  3048.  
  3049.     Description    : Move the operand, using the specified size, from
  3050.               the specified general register to a location wit-
  3051.               hin the address space defined by the destination
  3052.               function code (DFC) register. Or, move the oper-
  3053.               and, using the specified size, from the location
  3054.               within the address space defined by the source
  3055.               function code (SFC) register to the specified
  3056.               general register.
  3057.  
  3058.               This transfer is ONLY performed if the CPU is in
  3059.               supervisor mode. If the CPU is in user mode, then
  3060.               the Privilege Violation exception is taken.
  3061.  
  3062.               For suitable values of the SFC and DFC registers,
  3063.               see MC68020 Extra Registers above.
  3064.  
  3065.     Condition Codes : NOT AFFECTED.
  3066.  
  3067.     Instruction Format :
  3068.  
  3069.         0 0 0 0 1 1 1 0 Z Z M M M R R R
  3070.  
  3071.         A D D D X 0 0 0 0 0 0 0 0 0 0 0
  3072.  
  3073.     Instruction Fields :
  3074.  
  3075.         ZZ    : Size field. Specifies the size of the operation.
  3076.  
  3077.               00 = Byte Operation.
  3078.     
  3079.               01 = Word Operation.
  3080.  
  3081.               10 = Long Operation.
  3082.  
  3083.         MMM, RRR: See MC68020 Instruction Extension Words Above.
  3084.  
  3085.         A    : A/D field. Specifies whether the general register
  3086.               is a data or address register. 0 = data register,
  3087.               1 = address register.
  3088.  
  3089.         DDD    : Specifies which general register D0-D7 or A0-A7
  3090.               is used.
  3091.  
  3092.         X    : Direction field. 0 = from <ea> to general regis-
  3093.               ter, 1 = general register to <ea>.
  3094.  
  3095.     Addressing Modes : All EXCEPT Dn, An and #<data> are allowed for
  3096.                the address operand in each case.
  3097.  
  3098.     Notes : MOVES.x An,(An)+ or MOVES.x An,-(An) where the same address
  3099.         register is used for both source and destination operands,
  3100.         is an undefined operation. The value stored in memory is
  3101.         undefined. On the MC68010 and MC68020 implementations, the
  3102.         value stored is the increment or decrement value of An. This
  3103.         implementation MAY NOT APPEAR on future devices.
  3104.  
  3105.  
  3106. MULS    : Multiply Signed (MC68020 Extended Version)
  3107.  
  3108.     Operation : dst * src -> dst
  3109.  
  3110.     Assembler : MULS.L <ea>,Dl    ;32x32 -> 32
  3111.             MULS.L <ea>,Dh:Dl    ;32x32 -> 64
  3112.  
  3113.     Attributes: Size = Long.
  3114.  
  3115.     Description    : Multiply two operands using signed arithmetic,
  3116.               and store the result in the specified destina-
  3117.               tion.
  3118.  
  3119.               In the first form, two 32-bit numbers are multi-
  3120.               plied together, and a 32-bit result is stored in
  3121.               the specified destination.
  3122.  
  3123.               In the second form, two 32-bit numbers are multi-
  3124.               plied together, these numbers being stored at the
  3125.               source effective address and in the register des-
  3126.               ignated Dl above. The result is stored as a 64-
  3127.               bit value in Dh:Dl, Dh containing the high 32
  3128.               bits, and Dl the low 32 bits of the result.
  3129.  
  3130.     Condition Codes : X N Z V C
  3131.               - * * * 0
  3132.  
  3133.               N : Set if the result is negative. Cleared
  3134.                   otherwise.
  3135.  
  3136.               Z : Set if the result is zero. Cleared other-
  3137.                   wise.
  3138.  
  3139.               V : Set if overflow detected. Cleared other-
  3140.                   wise.
  3141.  
  3142.               C : Always Cleared.
  3143.  
  3144.               X : Not Affected.
  3145.  
  3146.               NOTE : Overflow (V=1) can ONLY occur with the
  3147.               first form of the instruction. This occurs when
  3148.               the high 32 bits of the result are NOT EQUAL to
  3149.               the sign-extension of the low 32 bits.
  3150.  
  3151.     Instruction Format :
  3152.  
  3153.         0 1 0 0 1 1 0 0 0 0 M M M R R R
  3154.  
  3155.         0 L L L 1 Z 0 0 0 0 0 0 0 H H H
  3156.  
  3157.  
  3158.     Instruction Fields :
  3159.  
  3160.         MMM, RRR: See MC68020 Instruction Extension Words Above.
  3161.               Define the addressing mode of the source oper-
  3162.               and.
  3163.  
  3164.         LLL    : Register Dl field. Specifies which data register
  3165.               is to be used as the Dl register in the above
  3166.               specification.
  3167.  
  3168.         Z    : Size field. A 0 value indicates a 32-bit product,
  3169.               a 1 value indicates a 64-bit product.
  3170.  
  3171.         HHH    : Register Dh field. Specifies which data register
  3172.               is to be used as the Dh register in the above
  3173.               specification. If Dh = Dl and Sz =1, then the
  3174.               result of the operation are undefined. If Sz=0,
  3175.               this field is unused (generally set to 0).
  3176.  
  3177.  
  3178. MULU: Multiply Unsigned (MC68020 Extended Version)
  3179.  
  3180.     Operation : dst * src -> dst
  3181.  
  3182.     Assembler : MULU.L <ea>,Dl    ;32x32 -> 32
  3183.             MULU.L <ea>,Dh:Dl    ;32x32 -> 64
  3184.  
  3185.     Attributes: Size = Long.
  3186.  
  3187.     Description    : Multiply two operands using unsigned arithmetic,
  3188.               and store the result in the specified destina-
  3189.               tion.
  3190.  
  3191.               In the first form, two 32-bit numbers are multi-
  3192.               plied together, and a 32-bit result is stored in
  3193.               the specified destination.
  3194.  
  3195.               In the second form, two 32-bit numbers are multi-
  3196.               plied together, these numbers being stored at the
  3197.               source effective address and in the register des-
  3198.               ignated Dl above. The result is stored as a 64-
  3199.               bit value in Dh:Dl, Dh containing the high 32
  3200.               bits, and Dl the low 32 bits of the result.
  3201.  
  3202.     Condition Codes : X N Z V C
  3203.               - * * * 0
  3204.  
  3205.               N : Set if the result is negative. Cleared
  3206.                   otherwise.
  3207.  
  3208.               Z : Set if the result is zero. Cleared other-
  3209.                   wise.
  3210.  
  3211.               V : Set if overflow detected. Cleared other-
  3212.                   wise.
  3213.  
  3214.               C : Always Cleared.
  3215.  
  3216.               X : Not Affected.
  3217.  
  3218.               NOTE : Overflow (V=1) can ONLY occur with the
  3219.               first form of the instruction. This occurs when
  3220.               the high 32 bits of the result are NOT EQUAL to
  3221.               the sign-extension of the low 32 bits.
  3222.  
  3223.     Instruction Format :
  3224.  
  3225.         0 1 0 0 1 1 0 0 0 0 M M M R R R
  3226.  
  3227.         0 L L L 0 Z 0 0 0 0 0 0 0 H H H
  3228.  
  3229.  
  3230.     Instruction Fields :
  3231.  
  3232.         MMM, RRR: See MC68020 Instruction Extension Words Above.
  3233.               Define the addressing mode of the source oper-
  3234.               and.
  3235.  
  3236.         LLL    : Register Dl field. Specifies which data register
  3237.               is to be used as the Dl register in the above
  3238.               specification.
  3239.  
  3240.         Z    : Size field. A 0 value indicates a 32-bit product,
  3241.               a 1 value indicates a 64-bit product.
  3242.  
  3243.         HHH    : Register Dh field. Specifies which data register
  3244.               is to be used as the Dh register in the above
  3245.               specification. If Dh = Dl and Sz =1, then the
  3246.               result of the operation are undefined. If Sz=0,
  3247.               this field is unused (generally set to 0).
  3248.  
  3249.  
  3250. PACK    : Pack data into a single byte.
  3251.  
  3252.     Operation : src (unpacked BCD) + adjustment -> dst (packed BCD)
  3253.  
  3254.     Assembler : PACK -(Ax),-(Ay),#<adjustment>
  3255.             PACK Dx,Dy,#<adjustment>
  3256.  
  3257.     Attributes: Unsized.
  3258.  
  3259.     Description    : The low four bits of two separate bytes are
  3260.               adjusted and packed into a single byte.
  3261.  
  3262.               When the source and destination operands are
  3263.               data registers, the operation is performed as
  3264.               follows:
  3265.  
  3266.               src : xxxxabcdyyyyefgh +
  3267.  
  3268.               adj : ....****....####
  3269.  
  3270.               The highlighted bits (marked '*' and '#') are
  3271.               then transferred to the destination as follows:
  3272.  
  3273.               dst : ****####
  3274.  
  3275.               When the source and destination operands are
  3276.               predecrement operands, two bytes are fetched
  3277.               from the source, concatenated to form a 16-
  3278.               bit operand, and the adjustment added as above.
  3279.               Then, the bits are transferred to the destina-
  3280.               tion byte as above and the data pointers are
  3281.               adjusted accordingly.
  3282.  
  3283.     Condition Codes : NOT AFFECTED.
  3284.  
  3285.     Instruction Format :
  3286.  
  3287.         1 0 0 0 Y Y Y 1 0 1 0 0 M X X X
  3288.  
  3289.         A A A A A A A A A A A A A A A A
  3290.  
  3291.     Instruction Fields :
  3292.  
  3293.         YYY    : Register Dy/Ay field:specifies the destina-
  3294.               tion register used.
  3295.  
  3296.         XXX    : Register Dx/Ax field:specifies the source
  3297.               register used.
  3298.  
  3299.         M    : Register/Memory Mode (R/M) field. Specifies
  3300.               whether the addressing mode is data register
  3301.               direct or predecrement.
  3302.  
  3303.               0 : Instruction is PACK Dx,Dy
  3304.  
  3305.               1 : Instruction is PACK -(Ax),-(Ay)
  3306.  
  3307.         AAA...    : Adjustment field. Contains the immediate data to
  3308.               be added to the source operand. Appropriate con-
  3309.               stants can be used to translate ASCII or EBCDIC
  3310.               strings to packed BCD.
  3311.  
  3312.     Example : PACK D1,D0,#0
  3313.  
  3314.           Before : D0 = $0000,
  3315.  
  3316.                D1 = $3231 (= ASCII string "21").
  3317.  
  3318.                Split word into bytes = $32, $31
  3319.  
  3320.                Zero out upper nibbles = $02, $01
  3321.  
  3322.                Concatenate these bytes to a word = $0201
  3323.  
  3324.                Add adjustment : $0201 + $0000 = $0201
  3325.  
  3326.                Now pack nibbles $2, $1 into a byte = $21
  3327.  
  3328.           After  : D0 = $0021.
  3329.  
  3330.  
  3331. RTD    : Return And Deallocate Parameters
  3332.  
  3333.     Operation : (SP) -> PC
  3334.             SP + d -> SP
  3335.  
  3336.     Assembler : RTD #<displacement>
  3337.  
  3338.     Attributes: Unsized.
  3339.  
  3340.     Description    : The program counter is pulled from the stack.
  3341.               The previous value of the program counter is
  3342.               lost. Then, the 16-bit displacement value is
  3343.               sign-extended to 32 bits and added to the
  3344.               stack pointer.
  3345.  
  3346.     Condition Codes : NOT AFFECTED.
  3347.  
  3348.     Instruction Format :
  3349.  
  3350.         0 1 0 0 1 1 1 0 0 1 1 1 0 1 0 0
  3351.  
  3352.         D D D D D D D D D D D D D D D D
  3353.  
  3354.     Instruction Fields :
  3355.  
  3356.         DDD...    : Displacement field. Specifies the 16-bit
  3357.               displacement to sign-extend and add to the
  3358.               stack pointer after pulling the program
  3359.               counter from the stack.
  3360.  
  3361.  
  3362. RTE    : Return From Exception (MC68020)
  3363.  
  3364.       (PRIVILEGED INSTRUCTION).
  3365.  
  3366.     Operation : IF supervisor state
  3367.             THEN
  3368.               (SP) -> SR
  3369.               SP + 2 -> SP
  3370.               (SP) -> PC
  3371.               SP + 4 -> SP
  3372.               (SP) -> Internal Format Word register
  3373.               Interpret format word and pull stack
  3374.               frame off stack, restore state
  3375.             ELSE
  3376.               TRAP (Privilege Violation)
  3377.  
  3378.     Assembler : RTE
  3379.  
  3380.     Attributes: Unsized.
  3381.  
  3382.     Description    : If the CPU is in the supervisor state, then
  3383.               pull the status register from the stack,
  3384.               followed by the program counter. Then pull
  3385.               the stack frame format word from the stack,
  3386.               and examine the format field to determine
  3387.               if any extra words are to be pulled from
  3388.               the stack, and how many. If extra words are
  3389.               to be pulled from the stack, pull them and
  3390.               restore to internal registers if needed.
  3391.  
  3392.               If the CPU is in the user state, then the
  3393.               CPU takes the Privilege Violation excep-
  3394.               tion.
  3395.  
  3396.     Condition Codes : ALL AFFECTED ACCORDING TO THE WORD PULLED FROM
  3397.               THE STACK.
  3398.  
  3399.     Instruction Format :
  3400.  
  3401.         0 1 0 0 1 1 1 0 0 1 1 1 0 0 1 1
  3402.  
  3403.     Stack Frame Format Word Format (pulled off the stack by the
  3404.     RTE instruction) :
  3405.  
  3406.         F F F F 0 0 V V V V V V V V V V
  3407.  
  3408.     Stack Frame Format Word Fields :
  3409.               
  3410.         FFFF    : Format field. Specifies the format of the
  3411.               stack frame to be pulled from the stack.
  3412.               Values interpreted are:
  3413.  
  3414.               0000    : Short Format. Only four words are
  3415.                   removed from the stack (SR, PC and
  3416.                   this format word).
  3417.  
  3418.               0001    : Throwaway Format. Four words are
  3419.                   removed from the currently active
  3420.                   stack, and SR only is updated from
  3421.                   this stack frame. Then, the CPU
  3422.                   begins executing the RTE from the
  3423.                   top of the active stack AFTER pul-
  3424.                   ling SR. This format is used to
  3425.                   mark the bottom of the Interrupt
  3426.                   Stack, and when the CPU is using
  3427.                   the Master Stack for exception
  3428.                   processing.
  3429.  
  3430.               0010    : Instruction Error format. Six words
  3431.                   are pulled from the top of the stack.
  3432.                   The first four words are as for the
  3433.                   short format:the remaining two words
  3434.                   are discarded.
  3435.  
  3436.               1000    : MC68010 Long Format. The MC68020 takes
  3437.                   a Format Error exception.
  3438.  
  3439.               1001    : Coprocessor Mid-Instruction Format. 10
  3440.                   words are removed from the stack. Re-
  3441.                   sumes coprocessor instruction execution.
  3442.  
  3443.               1010    : MC68020 Short Format. 16 words are re-
  3444.                   moved from the stack. Resumes instruc-
  3445.                   tion execution.
  3446.  
  3447.               1011    : MC68020 Long Format. 46 words are re-
  3448.                   moved from the stack. Resumes instruc-
  3449.                   tion execution.
  3450.  
  3451.               Any other values:the CPU takes a Format Error
  3452.               exception.
  3453.  
  3454.         VVV...    : Vector Offset field. This field contains the
  3455.               exception number that was generated.
  3456.  
  3457.  
  3458. RTM    : Return From Module
  3459.  
  3460.     Operation : Reload saved module state from stack.
  3461.  
  3462.     Assembler : RTM Rn
  3463.  
  3464.     Attributes: Unsized.
  3465.  
  3466.     Description    : A previously saved module state (as saved by
  3467.               the CALLM instruction) is reloaded from the
  3468.               top of the stack. After the module state is
  3469.               retrieved from the top of the stack, the
  3470.               caller's stack pointer is incremented by the
  3471.               argument count value in the module state.
  3472.  
  3473.               Like CALLM above, this instruction requires
  3474.               external hardware support, usually from the
  3475.               MC68851 Paged Memory Management Unit (PMMU)
  3476.               but also from other sources.
  3477.  
  3478.     Condition Codes : ALL AFFECTED ACCORDING TO THE CONTENT OF THE
  3479.               WORD ON THE STACK.
  3480.  
  3481.     Instruction Format :
  3482.  
  3483.         0 0 0 0 0 1 1 0 1 1 0 0 A R R R
  3484.  
  3485.     Instruction Fields :
  3486.  
  3487.         A    : D/A field. Specifies whether the module data
  3488.               pointer is a data or an address register.
  3489.  
  3490.               0 = Data Register.
  3491.  
  3492.               1 = Address Register.
  3493.  
  3494.         RRR    : Register Field. Specifies the register number
  3495.               for the module data pointer which is to be
  3496.               restored from the saved module state. If the
  3497.               register specified is A7 (SP), the updated
  3498.               value of the register reflects the stack poin-
  3499.               ter operations, and the saved module data area
  3500.               pointer is lost.
  3501.  
  3502.  
  3503. TRAP    : TRAP Instruction (MC68020)
  3504.  
  3505.     Operation : SSP - 2 -> SSP
  3506.             Format/Offset -> (SSP)
  3507.             SSP - 4 -> SSP
  3508.             PC -> (SSP)
  3509.             SSP - 2 -> SSP
  3510.             SR -> (SSP)
  3511.             TRAP Vector Address -> PC
  3512.  
  3513.     Assembler : TRAP #<vector>
  3514.  
  3515.     Attributes: Unsized.
  3516.  
  3517.     Description    : The processor initiates exception processing.
  3518.               The vector number is generated to reference
  3519.               the TRAP instruction vector specified by the
  3520.               low order four bits of the instruction.
  3521.  
  3522.               Sixteen TRAP instruction vectors (0-15) are
  3523.               available.
  3524.  
  3525.     Condition Codes : NOT AFFECTED.
  3526.  
  3527.     Instruction Format :
  3528.  
  3529.         0 1 0 0 1 1 1 0 0 1 0 0 V V V V
  3530.  
  3531.     Instruction Fields :
  3532.  
  3533.         VVVV    : Vector Field. Specifies which TRAP vector
  3534.               contains the new value of the program coun-
  3535.               ter to be loaded.
  3536.  
  3537.  
  3538.  
  3539. TRAPcc    : Trap On Condition
  3540.  
  3541.     Operation : IF condition = TRUE
  3542.             THEN
  3543.               TRAP (TRAPV/TRAPcc Vector)
  3544.             ELSE
  3545.               continue normal execution
  3546.  
  3547.     Assembler : TRAPcc
  3548.             TRAPcc.W #<data>
  3549.             TRAPcc.L #<data)
  3550.  
  3551.     Attributes: Unsized or Size = Word, Long.
  3552.  
  3553.     Description    : If the condition specified in the instruction is
  3554.               true, then the CPU initiates exception processing.
  3555.               The vector number is generated to reference the
  3556.               TRAPcc exception vector. The stacked program val-
  3557.               ue points to the next instruction after the TRAPcc.
  3558.               If the condition specified is false, then no oper-
  3559.               ation occurs, and execution continues at the ins-
  3560.               truction immediately following the TRAPcc.
  3561.  
  3562.               If an immediate data operand is specified, then
  3563.               the word (or words) containing that data follow
  3564.               the TRAPcc instruction immedaitely, and this data
  3565.               is available to the programmer as a user-definable
  3566.               data field for use within the trap handler. For a
  3567.               full list of CPU conditions see typed_68000.doc.
  3568.  
  3569.     Condition Codes : NOT AFFECTED.
  3570.  
  3571.     Instruction Format :
  3572.  
  3573.         0 1 0 1 C C C C 1 1 1 1 1 M M M
  3574.  
  3575.         W W W W W W W W W W W W W W W W
  3576.  
  3577.         L L L L L L L L L L L L L L L L
  3578.  
  3579.     Instruction Fields :
  3580.  
  3581.         CCCC    : Condition Code field. Selects one of the 16
  3582.               possible conditions for the TRAPcc instruc-
  3583.               tion. For a full list of conditions see the
  3584.               companion file typed_68000.doc.
  3585.  
  3586.         MMM    : Op-Mode field. Selects the instruction form.
  3587.  
  3588.               010 : Instruction is followed by one operand
  3589.                 word.
  3590.  
  3591.               011 : Instruction is followed by two operand
  3592.                 words.
  3593.  
  3594.               100 : Instruction has no following operand
  3595.                 words.
  3596.  
  3597.  
  3598. UNPK    : Unpack BCD
  3599.  
  3600.     Operation : src (Packed BCD) + adjustment -> dst (Unpacked BCD)
  3601.  
  3602.     Assembler : UNPK -(Ax),-(Ay),#<adjustment>
  3603.             UNPK Dx,Dy,#<adjustment>
  3604.  
  3605.     Attributes: Unsized.
  3606.  
  3607.     Description    : In the unpack operation, the byte operand is
  3608.               split into its two component nibbles, and each
  3609.               nibble is then zero-extended to a byte value.
  3610.               These new byte values are concatenated into a
  3611.               single 16-bit value. Then, the value of the ad-
  3612.               justment is added to this 16-bit value, and the
  3613.               two resulting bytes moved to the destination.
  3614.  
  3615.               If the destination is a data register, then the
  3616.               result is moved as a single 16-bit word to the
  3617.               data register.
  3618.  
  3619.     Condition Codes : NOT AFFECTED.
  3620.  
  3621.     Instruction Format :
  3622.  
  3623.         1 0 0 0 Y Y Y 1 1 0 0 0 M X X X
  3624.  
  3625.         A A A A A A A A A A A A A A A A
  3626.  
  3627.     Instruction Fields :
  3628.  
  3629.         YYY    : Register Dy/Ay field:specifies the destina-
  3630.               tion register used.
  3631.  
  3632.         XXX    : Register Dx/Ax field:specifies the source
  3633.               register used.
  3634.  
  3635.         M    : Register/Memory Mode (R/M) field. Specifies
  3636.               whether the addressing mode is data register
  3637.               direct or predecrement.
  3638.  
  3639.               0 : Instruction is UNPK Dx,Dy
  3640.  
  3641.               1 : Instruction is UNPK -(Ax),-(Ay)
  3642.  
  3643.         AAA...    : Adjustment field. Contains the immediate data to
  3644.               be added to the source operand. Appropriate con-
  3645.               stants can be used to translate packed BCD to
  3646.               ASCII or EBCDIC strings.
  3647.  
  3648.     Example : UNPK D1,D0,#$3030
  3649.  
  3650.           Before : D1 = $0021 (BCD 21)
  3651.  
  3652.                Unpack nibbles into bytes = $02, 01
  3653.  
  3654.                Concatenate bytes to word = $0201
  3655.  
  3656.                $0201 + $3030 = $3231
  3657.  
  3658.           After  : D0 = $3132 (ASCII "21")
  3659.  
  3660.  
  3661.  
  3662.  
  3663.  
  3664.  
  3665.